analyzetool/dynamicmemoryhook/inc/analyzetoolmainallocator.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 49 7fdc9a71d314
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
    20 #define ANALYZETOOLMAINALLOCATOR_H
    20 #define ANALYZETOOLMAINALLOCATOR_H
    21 
    21 
    22 // INCLUDES
    22 // INCLUDES
    23 #include <u32std.h>
    23 #include <u32std.h>
    24 #include "codeblock.h"
    24 #include "codeblock.h"
       
    25 #include <analyzetool/atstorageserverclnt.h>
    25 #include <analyzetool/analyzetool.h>
    26 #include <analyzetool/analyzetool.h>
    26 #include <analyzetool/atcommon.h>
    27 #include <analyzetool/atcommon.h>
    27 #include "analyzetoolmemoryallocator.h"
    28 #include "analyzetoolmemoryallocator.h"
    28 #include "analyzetooleventhandlernotifier.h"
    29 #include "analyzetooleventhandlernotifier.h"
    29 #include "analyzetoolfilelog.h"
       
    30 
    30 
    31 // FORWARD DECLARATIONS
    31 // FORWARD DECLARATIONS
    32 class CLibraryEventHandler;
    32 class CLibraryEventHandler;
    33 
    33 
    34 // CLASS DECLARATION
    34 // CLASS DECLARATION
    45 
    45 
    46         /**
    46         /**
    47         * C++ default constructor.
    47         * C++ default constructor.
    48         * @param aNotFirst Is this first thread using this heap
    48         * @param aNotFirst Is this first thread using this heap
    49         * @param aFileName The name of the log file
    49         * @param aFileName The name of the log file
    50         * @param aLogOption The logging option
    50         * @param aLogOption The logging option for storage server
    51         * @param aIsDebug Determines whether a binary is UDEB or UREL
    51         * @param aIsDebug Determines whether a binary is UDEB or UREL
    52         * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
    52         * @param aAllocCallStackSize Max number of stored callstack items when memory allocated
    53         * @param aFreeCallStackSize Max number of stored callstack items when memory freed
    53         * @param aFreeCallStackSize Max number of stored callstack items when memory freed
    54         * @param aAtoolVersion Version of atool
       
    55         * @param aApiVersion Version of api
       
    56         */
    54         */
    57         RAnalyzeToolMainAllocator( TBool aNotFirst,
    55         RAnalyzeToolMainAllocator( TBool aNotFirst,
    58                 const TFileName& aFileName,
    56                 const TFileName aFileName,
    59                 const TPath& aFilePath,
       
    60                 TUint32 aLogOption, TUint32 aIsDebug,
    57                 TUint32 aLogOption, TUint32 aIsDebug,
    61                 TUint32 aAllocCallStackSize,
    58                 TUint32 aAllocCallStackSize,
    62                 TUint32 aFreeCallStackSize,
    59                 TUint32 aFreeCallStackSize );
    63                 const TDesC8& aAtoolVersion,
       
    64                 const TDesC8& aApiVersion );
       
    65 
    60 
    66         /**
    61         /**
    67         * Destructor.
    62         * Destructor.
    68         */
    63         */
    69         ~RAnalyzeToolMainAllocator();
    64         ~RAnalyzeToolMainAllocator();
   194         * Shares the heap
   189         * Shares the heap
   195         */
   190         */
   196         void ShareHeap();
   191         void ShareHeap();
   197 
   192 
   198     public: // inlines
   193     public: // inlines
   199             
   194     
       
   195         /**
       
   196         * Acquires the open RATStorageServer handle
       
   197         * @return RATStorageServer& The open RATStorageServer handle
       
   198         */
       
   199         inline RATStorageServer& StorageServer();
       
   200         
   200         /**
   201         /**
   201         * Acquires the codeblocks of the process
   202         * Acquires the codeblocks of the process
   202         * @return RArray<TCodeblock>& The process codeblocks
   203         * @return RArray<TCodeblock>& The process codeblocks
   203         */
   204         */
   204         inline RArray<TCodeblock>& Codeblocks();
   205         inline RArray<TCodeblock>& Codeblocks();
   218         /**
   219         /**
   219 		* Acquires the logical channel handle
   220 		* Acquires the logical channel handle
   220 		* @return RAnalyzeTool A reference to logical channel
   221 		* @return RAnalyzeTool A reference to logical channel
   221 		*/
   222 		*/
   222         inline RAnalyzeTool& AnalyzeTool();
   223         inline RAnalyzeTool& AnalyzeTool();
       
   224  
       
   225          /**
       
   226         * Acquires information if storage server is open
       
   227         * @return TBool iStorageServerOpen
       
   228         */
       
   229         inline TBool StorageServerOpen();
   223                 
   230                 
   224         /**
   231         /**
   225         * Acquires the log option type 
   232         * Acquires the log option type 
   226         * @return TUint32 iLogOption
   233         * @return TUint32 iLogOption
   227         */        
   234         */        
   236         /**
   243         /**
   237          * Acquires the max size of call stack when memory freed
   244          * Acquires the max size of call stack when memory freed
   238          * @return TUint32 iFreeMaxCallStack
   245          * @return TUint32 iFreeMaxCallStack
   239          */
   246          */
   240         inline TUint32 FreeMaxCallStack();
   247         inline TUint32 FreeMaxCallStack();
   241         
       
   242         /**
       
   243          * Acquires handle to lig file
       
   244          * @return RATFileLog iLogFile
       
   245          */
       
   246         inline RATFileLog& LogFile();
       
   247 
   248 
   248     private: // private functions
   249     private: // private functions
   249 
   250 
   250         /**
   251         /**
   251         * Log the process initial information
   252         * Log the process initial information
   252         * @param aFileName The name of the log file
   253         * @param aFileName The name of the log file
   253         * @param aLogOption The logging option
   254         * @param aLogOption The logging option for storage serve
   254         * @param aIsDebug Determines whether a binary is UDEB or UREL
   255         * @param aIsDebug Determines whether a binary is UDEB or UREL
   255         */
   256         */
   256         void LogProcessInformation( const TFileName& aFileName,  const TPath& aFilePath,  TUint32 aLogOption,
   257         void LogProcessInformation( const TFileName aFileName, TUint32 aLogOption,
   257         		TUint32 aIsDebug, const TDesC8& aAtoolVersion, const TDesC8& aApiVersion );
   258                                                                 TUint32 aIsDebug );
   258 
   259 
   259         /**
   260         /**
   260         * Find the current thread which is using the heap
   261         * Find the current thread which is using the heap
   261         * @param aStackStart A reference where the stack start is stored
   262         * @param aStackStart A reference where the stack start is stored
   262         * @return TBool ETrue if a thread can be found, EFalse otherwise
   263         * @return TBool ETrue if a thread can be found, EFalse otherwise
   265         
   266         
   266         /**
   267         /**
   267         * Installs the eventhandler, if possible
   268         * Installs the eventhandler, if possible
   268         */
   269         */
   269         void InstallEventHandler();
   270         void InstallEventHandler();
   270         
       
   271         /**
       
   272         * Logs version of ATApp, ATApi, S60 version and ROM checksum 
       
   273         * at the startup of hooked application
       
   274         */
       
   275         void LogDeviceInfo();
       
   276 
   271 
   277     private: // member variables
   272     private: // member variables
       
   273             
       
   274         /* Handle to the RATStorageServer */
       
   275         RATStorageServer iStorageServer;
   278 
   276 
   279         /* Handle to the RAnalyzeTool */		
   277         /* Handle to the RAnalyzeTool */		
   280         RAnalyzeTool iAnalyzeTool;           
   278         RAnalyzeTool iAnalyzeTool;           
   281         
   279         
   282         /* A flag for indicating that the RAnalyzeTool is open */
   280         /* A flag for indicating that the RAnalyzeTool is open */
   303         /* Array for storing the reallocation callstack */	
   301         /* Array for storing the reallocation callstack */	
   304         TFixedArray<TUint32, KATMaxFreeCallstackLength> iFreeCallStack;
   302         TFixedArray<TUint32, KATMaxFreeCallstackLength> iFreeCallStack;
   305                 
   303                 
   306         /* Array of threads using this heap */
   304         /* Array of threads using this heap */
   307         RArray<TThreadStack> iThreadArray;
   305         RArray<TThreadStack> iThreadArray;
       
   306 
       
   307         /* A flag for indicating that the RATStorageServer is open */
       
   308         TBool iStorageServerOpen;
   308         
   309         
   309         /* Log option */
   310         /* Log option */
   310         TUint32 iLogOption;
   311         TUint32 iLogOption;
   311 
   312 
   312         /* The process id */
   313         /* The process id */
   316         TUint32 iAllocMaxCallStack;
   317         TUint32 iAllocMaxCallStack;
   317         
   318         
   318         /* Max items on stored call stack when memory freed */
   319         /* Max items on stored call stack when memory freed */
   319         TUint32 iFreeMaxCallStack;
   320         TUint32 iFreeMaxCallStack;
   320         
   321         
   321         /* Binary log file */
       
   322         RATFileLog iLogFile;
       
   323        
       
   324         
       
   325     };
   322     };
   326 
   323 
   327 // INLINES
   324 // INLINES
   328 #include "analyzetoolmainallocator.inl"
   325 #include "analyzetoolmainallocator.inl"
   329 
   326