# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284548007 -10800 # Node ID 7fdc9a71d314ed386f2296e24215d703e2a06c89 # Parent e26895079d7cfa8eb2dd653147036ef369f64d1a Revision: 201035 Kit: 201036 diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/analyzetool_plat/analyzetool_api/analyzetool_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analyzetool/analyzetool_plat/analyzetool_api/analyzetool_api.metaxml Wed Sep 15 13:53:27 2010 +0300 @@ -0,0 +1,17 @@ + + + AnalyzeTool API + Defines the API, which is used by application compiled with AnlayzeTool. + c++ + AnalyzeTool + + + + + + + + no + no + + diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/analyzetool_plat/analyzetool_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analyzetool/analyzetool_plat/analyzetool_api/group/bld.inf Wed Sep 15 13:53:27 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 + +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) + diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h Wed Sep 15 13:53:27 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 + +//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 TMainThreadParamsBuf; + +class TLibraryInfo + { + public: + TBuf8 iLibraryName; + TLinAddr iRunAddress; + TUint32 iSize; + TInt iIndex; + TUint iProcessId; + }; + +typedef TPckgBuf TLibraryInfoBuf; + +class TCodesegInfo + { + public: + TBuf8 iFullName; + TLinAddr iRunAddress; + TUint32 iSize; + TInt iIndex; + TUint iProcessId; + TInt iCodesegIndex; + TLinAddr iFileEntryPoint; + TInt iFuntionCount; + TLibraryFunction iFirstFunction; + TModuleMemoryInfo iMemoryInfo; + }; + +typedef TPckgBuf TCodesegInfoBuf; + +class TThreadParams + { + public: + TLinAddr iStackAddress; + TInt iStackSize; + TUint iThreadId; + }; + +typedef TPckgBuf TThreadParamsBuf; + +class TProcessIdentityParams + { + public: + TBuf8 iProcessName; + TInt iDynamicCount; + TInt iCodesegCount; + TUint iProcessId; + TUint iThreadId; + TLinAddr iStackAddress; + TInt iStackSize; + }; + +typedef TPckgBuf TProcessIdentityParamsBuf; + +class TLibraryEventInfo + { + public: + enum TLibraryEvent + { + ELibraryAdded = 0, + ELibraryRemoved, + EKillThread + }; + + public: + TUint iProcessId; + TBuf8 iLibraryName; + TLinAddr iRunAddress; + TUint32 iSize; + TLibraryEvent iEventType; + TUint iThreadId; + }; + +typedef TPckgBuf TLibraryEventInfoBuf; + +class TProcessHandleInfo + { + public: + TInt iProcessHandleCount; + TInt iThreadHandleCount; + TInt iIndex; + TInt iThreadCount; + TLinAddr iUserStackRunAddress; + TInt iUserStackSize; + TUint iProcessId; + }; + +typedef TPckgBuf 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 TATProcessHandlesBuf; + +class TClientCount + { + public: + + /** The count of clients */ + TInt iClientCount; + }; + +typedef TPckgBuf TClientCountBuf; + +class TATMemoryModel + { + public : + /* Memory model*/ + TUint32 iMemoryModel; + }; +typedef TPckgBuf 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 + +#endif // #ifndef __ANALYZETOOL_H__ + +// End of File diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.inl Wed Sep 15 13:53:27 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 diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetoolcleaner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetoolcleaner.h Wed Sep 15 13:53:27 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 + +// CONSTANTS +#define ATCLEANERTABLESIZE 10 +#define ATCLEANERTABLE TFixedArray +_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__ diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetooltraceconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetooltraceconstants.h Wed Sep 15 13:53:27 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 + +// 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, " " ); +_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 (" ") +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 ( 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 +// <> PCS