analyzetool/analyzetool_plat/analyzetool_api/inc/analyzetool/analyzetool.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 49 7fdc9a71d314
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declaration of the class RAnalyzeTool.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __ANALYZETOOL_H__
       
    20 #define __ANALYZETOOL_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32cmn.h>
       
    24 
       
    25 //Version information for command line engine.
       
    26 //Tells the version of AT core componenets.
       
    27 //ANALYZETOOL_CORE_VERSION_FOR_CLE 1.10.0
       
    28 
       
    29 // CONSTANTS
       
    30 inline TVersion KAnalyzeToolLddVersion() { return TVersion(1, 0, 1); }
       
    31 
       
    32 /* The name of the analyze tool device driver*/
       
    33 _LIT( KAnalyzeToolLddName, "AToolKernelEventHandler" );
       
    34 
       
    35 /* The priority of AnalyzeTool Dfc */
       
    36 const TInt KAnalyzeToolThreadPriority = 27;
       
    37 
       
    38 /* The name of the AnalyzeTool DFC */
       
    39 _LIT8( KAnalyzeToolThreadName, "AnalyzeToolThreadDfc" );
       
    40 
       
    41 /* The panic literal */
       
    42 _LIT( KClientPanic, "AnalyzeTool" );
       
    43 
       
    44 //const TInt KATMaxCallstackLength = 20;
       
    45 
       
    46 /* The device handler panic codes */
       
    47 enum TPanic
       
    48 	{
       
    49 	EPanicRequestPending,
       
    50 	EPanicNoRequestPending,
       
    51 	EPanicUnsupportedRequest
       
    52 	};
       
    53 
       
    54 // Size of following must be multiple of 4 bytes.
       
    55 
       
    56 class TMainThreadParams
       
    57 	{
       
    58 	public:
       
    59 		RAllocator* iAllocator;
       
    60 		TBool       iAlone;
       
    61 		TUint       iProcessId;
       
    62 	};
       
    63 typedef TPckgBuf<TMainThreadParams> TMainThreadParamsBuf;
       
    64 
       
    65 class TLibraryInfo
       
    66 	{
       
    67 	public:
       
    68 		TBuf8<KMaxLibraryName> iLibraryName;
       
    69 		TLinAddr  iRunAddress;
       
    70 		TUint32   iSize;
       
    71 		TInt      iIndex;
       
    72 		TUint     iProcessId;
       
    73 	};
       
    74 
       
    75 typedef TPckgBuf<TLibraryInfo> TLibraryInfoBuf;
       
    76 
       
    77 class TCodesegInfo
       
    78 	{
       
    79 	public:
       
    80 		TBuf8<KMaxLibraryName> iFullName;
       
    81 		TLinAddr iRunAddress;
       
    82 		TUint32  iSize;
       
    83 		TInt  iIndex;
       
    84 		TUint iProcessId;
       
    85 		TInt  iCodesegIndex; 
       
    86 		TLinAddr iFileEntryPoint;
       
    87 		TInt     iFuntionCount;
       
    88 		TLibraryFunction iFirstFunction;
       
    89 		TModuleMemoryInfo iMemoryInfo;
       
    90 	};
       
    91 
       
    92 typedef TPckgBuf<TCodesegInfo> TCodesegInfoBuf;
       
    93 
       
    94 class TThreadParams
       
    95 	{		
       
    96 	public:
       
    97 	    TLinAddr iStackAddress;
       
    98 	    TInt iStackSize;
       
    99 	    TUint iThreadId;
       
   100 	};
       
   101 
       
   102 typedef TPckgBuf<TThreadParams> TThreadParamsBuf;
       
   103 
       
   104 class TProcessIdentityParams
       
   105 	{		
       
   106 	public:
       
   107 		TBuf8<KMaxProcessName> iProcessName;
       
   108 		TInt iDynamicCount;
       
   109 		TInt iCodesegCount;
       
   110 		TUint iProcessId;
       
   111 		TUint iThreadId;
       
   112 	    TLinAddr iStackAddress;
       
   113 	    TInt iStackSize;
       
   114 	};
       
   115 
       
   116 typedef TPckgBuf<TProcessIdentityParams> TProcessIdentityParamsBuf;
       
   117 
       
   118 class TLibraryEventInfo
       
   119 	{
       
   120 	public:
       
   121 		enum TLibraryEvent
       
   122 			{ 
       
   123 			ELibraryAdded = 0, 
       
   124 			ELibraryRemoved,
       
   125 			EKillThread 
       
   126 			};
       
   127 					
       
   128 	public:
       
   129 		TUint iProcessId;
       
   130 		TBuf8<KMaxLibraryName> iLibraryName;
       
   131 		TLinAddr iRunAddress;
       
   132 		TUint32 iSize;
       
   133 		TLibraryEvent iEventType;
       
   134 		TUint iThreadId;
       
   135 	};
       
   136 
       
   137 typedef TPckgBuf<TLibraryEventInfo> TLibraryEventInfoBuf;
       
   138 
       
   139 class TProcessHandleInfo
       
   140 	{
       
   141 	public:
       
   142 		TInt     iProcessHandleCount;
       
   143 		TInt     iThreadHandleCount;
       
   144 		TInt     iIndex;
       
   145 		TInt     iThreadCount;
       
   146 		TLinAddr iUserStackRunAddress;
       
   147 		TInt     iUserStackSize;
       
   148 		TUint    iProcessId;
       
   149 	};
       
   150 
       
   151 typedef TPckgBuf<TProcessHandleInfo> TProcessHandleInfoBuf;
       
   152 
       
   153 /**
       
   154 *  A class for particular process's current handle count
       
   155 */
       
   156 class TATProcessHandles
       
   157     {
       
   158     public:
       
   159     
       
   160         /** The ID of the process. */
       
   161         TUint iProcessId;
       
   162         
       
   163         /** The number of current handles in the library. */
       
   164         TInt iCurrentHandleCount;
       
   165     };
       
   166 
       
   167 typedef TPckgBuf<TATProcessHandles> TATProcessHandlesBuf;
       
   168 
       
   169 class TClientCount
       
   170     {
       
   171     public:
       
   172     
       
   173         /** The count of clients */
       
   174         TInt iClientCount;     
       
   175     };
       
   176 
       
   177 typedef TPckgBuf<TClientCount> TClientCountBuf;
       
   178 
       
   179 class TATMemoryModel
       
   180     {
       
   181     public :
       
   182         /* Memory model*/
       
   183         TUint32 iMemoryModel;
       
   184     };
       
   185 typedef TPckgBuf<TATMemoryModel> TATMemoryModelBuf;
       
   186 
       
   187 // CLASS DECLARATION
       
   188 
       
   189 /**
       
   190 *  The user-side handle to a logical channel which provides functions to 
       
   191 *  open a channel and to make requests to a analyze tool device driver. 
       
   192 */
       
   193 
       
   194 class RAnalyzeTool : public RBusLogicalChannel
       
   195 	{
       
   196 	
       
   197 	public:
       
   198 		
       
   199 	/** Enumeration of supported functions */
       
   200 	enum TBasicAnalyzerControl
       
   201 		{
       
   202 		EGetProcessInfo = 0, /* The process information */
       
   203 		EGetCodesegInfo,	 /* The codesegment information */
       
   204 		EGetLibraryInfo,     /* The library information */
       
   205 		EGetDynamicInfo,	 /* The count of dynamic code in the process */
       
   206 		ELibraryEvent,       /* Subscribe events from library events */
       
   207 		ECancelLibraryEvent, /* Cancel subscribetion of library events */
       
   208 		ECurrentClientCount,  /* The count of clients in device driver */
       
   209 		EMainThreadAlloctor,
       
   210 		EThreadStack,
       
   211 		EGetProcessHandle,	/* Gets process global handles info*/
       
   212 		EGetCurrentHandles, /* Get a process's current handle count */
       
   213 		EGetMemoryModel
       
   214 		};
       
   215 			
       
   216 #ifndef __KERNEL_MODE__
       
   217 
       
   218         /**
       
   219         * Opens a handle to a logical channel.
       
   220         * @return TInt Returns KErrNone, if successful or otherwise 
       
   221         		  one of the other system-wide error codes
       
   222         */
       
   223 		inline TInt Open();
       
   224 
       
   225         /**
       
   226         * Acquires process information.
       
   227         * @param aProcessIdentityParams The process information which 
       
   228         								is filled by the device driver
       
   229         * @return TInt Returns KErrNone, if successful
       
   230         			   otherwise one of the other system-wide error codes
       
   231         */
       
   232 		inline TInt GetProcessInfo( 
       
   233 				TProcessIdentityParamsBuf& aProcessIdentityParams );
       
   234 
       
   235         /**
       
   236         * Acquires codeseg information.
       
   237         * @param aCodesegInfo The codeseg information which 
       
   238         					  is filled by the device driver
       
   239         * @return TInt Returns KErrNone, if successful
       
   240         			   otherwise one of the other system-wide error codes
       
   241         */
       
   242 		inline TInt GetCodesegInfo( TCodesegInfoBuf& aCodesegInfo );
       
   243 		
       
   244         /**
       
   245         * Acquires library information.
       
   246         * @param aLibraryInfo The library information which 
       
   247         					  is filled by the device driver
       
   248         * @return TInt Returns KErrNone, if successful
       
   249         			   otherwise one of the other system-wide error codes
       
   250         */
       
   251 		inline TInt GetLibraryInfo( TLibraryInfoBuf& aLibraryInfo );
       
   252 				
       
   253         /**
       
   254         * Subscribes library event.
       
   255         * @param aStatus The request status object for this request. 
       
   256         * @param aLibraryInfo The library information which 
       
   257         					  is filled by the device driver
       
   258         * @return TInt Returns KErrNone, if successful
       
   259         			   otherwise one of the other system-wide error codes
       
   260         */
       
   261 		inline void LibraryEvent( TRequestStatus& aStatus, 
       
   262 		                          TLibraryEventInfo& aLibraryInfo );
       
   263 		
       
   264         /**
       
   265         * Cancels subscribetion of the library event.
       
   266         */
       
   267 		inline void CancelLibraryEvent();
       
   268 
       
   269         /**
       
   270         * Acquires device driver current client count.
       
   271         * @param aClientCount A reference to TInt which is 
       
   272         				      updated by the device driver.
       
   273         * @return TInt Returns KErrNone, if successful
       
   274         			   otherwise one of the other system-wide error codes
       
   275         */
       
   276 		inline TInt ClientCount( TClientCountBuf& aClientCount );
       
   277 		
       
   278         /**
       
   279         * Acquires process main thread RAllocator
       
   280         * @param aMainThreadParams The main thread information which 
       
   281         					        is filled by the device driver
       
   282         * @return TInt Returns KErrNone, if successful
       
   283         			   otherwise one of the other system-wide error codes
       
   284         */	
       
   285 		inline TInt MainThreadAlloctor( TMainThreadParamsBuf& aMainThreadParams );
       
   286 		
       
   287 		/**
       
   288 		* Acquires main thread stack address.
       
   289 		* @param aThreadStack Pointer to the TThreadParams object.
       
   290 		* @return TInt Returns KErrNone, if successful
       
   291 					   otherwise one of the other system-wide error codes
       
   292 		*/
       
   293 		inline TInt ThreadStack( TThreadParamsBuf& aThreadStack );
       
   294 
       
   295         /**
       
   296         * Acquires information about process global handles.
       
   297         * @param aProcessHandleInfo Pointer to the TProcessHandleInfo object.
       
   298         * @return TInt Returns KErrNone, if successful
       
   299         			   otherwise one of the other system-wide error codes
       
   300         */
       
   301 		inline TInt GetProcessHandleInfo( TProcessHandleInfoBuf& aProcessHandleInfo );
       
   302 
       
   303         /**
       
   304         * Acquires a process's current handle count.
       
   305         * @param aProcessHandles Pointer to the TATProcessHandles object.
       
   306         * @return TInt Returns KErrNone, if successful
       
   307                        otherwise one of the other system-wide error codes
       
   308         */
       
   309         inline TInt GetCurrentHandleCount( TATProcessHandlesBuf& aProcessHandles );
       
   310 
       
   311         /**
       
   312          * Acquires memory model system uses.
       
   313          * @param aMemoryModel pointer to the TATMemoryModelBuf object.
       
   314          */
       
   315         inline TInt GetMemoryModel( TATMemoryModelBuf& aMemoryModel );
       
   316         
       
   317 #endif // #ifndef __KERNEL_MODE__
       
   318 	};
       
   319 
       
   320 // INLINES
       
   321 #include <analyzetool/analyzetool.inl>
       
   322 
       
   323 #endif // #ifndef __ANALYZETOOL_H__
       
   324 
       
   325 // End of File