memspy/memspy_plat/memspy_api/include/memspy/driver/shared/MemSpyDriverObjectsShared.h
changeset 51 98307c651589
parent 42 0ff24a8f6ca2
child 52 c2f44e33b468
equal deleted inserted replaced
42:0ff24a8f6ca2 51:98307c651589
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MEMSPYDRIVEROBJECTSSHARED_H
       
    19 #define MEMSPYDRIVEROBJECTSSHARED_H
       
    20 
       
    21 // System includes
       
    22 #include <u32std.h>
       
    23 
       
    24 // User includes
       
    25 #include <memspy/driver/memspydriverenumerationsshared.h>
       
    26 #include <memspy/driver/memspydriverobjectssharedrheap.h>
       
    27 
       
    28 // Classes referenced
       
    29 class CActiveScheduler;
       
    30 class CTrapCleanup;
       
    31 
       
    32 
       
    33 
       
    34 /**
       
    35  * ARM user registers.
       
    36  * Size must be multiple of 4 bytes.
       
    37  */
       
    38 class TMemSpyDriverRegSet
       
    39 	{
       
    40 public:
       
    41 	enum { KRegCount = 16 };
       
    42 	TUint32 iRn[KRegCount];
       
    43 	TUint32 iCpsr;
       
    44 	};
       
    45 
       
    46 
       
    47 /** 
       
    48  * ARM-specific exception-related data.
       
    49  * Size must be multiple of 4 bytes.
       
    50  */ 
       
    51 class TMemSpyDriverCpuExcInfo
       
    52 	{
       
    53 public:
       
    54 	enum TExcCode 
       
    55 		{ 
       
    56 		EPrefetchAbort=0,
       
    57 		EDataAbort=1,
       
    58 		EUndefinedOpcode=2,
       
    59 		};
       
    60 public:
       
    61 	TExcCode iExcCode;
       
    62 	/** Point to instruction which caused exception */
       
    63 	TUint32 iFaultPc;
       
    64 	/** 
       
    65      Address which caused exception (System Control Coprocessor Fault
       
    66 	 Address Register)
       
    67 	*/
       
    68 	TUint32 iFaultAddress;
       
    69 	/** System Control Coprocessor Fault Status Register */
       
    70 	TUint32 iFaultStatus;
       
    71 	/** R13 supervisor mode banked register */
       
    72 	TUint32 iR13Svc;
       
    73 	/** R14 supervisor mode banked register */
       
    74 	TUint32 iR14Svc;
       
    75 	/** SPSR supervisor mode banked register */
       
    76 	TUint32 iSpsrSvc;
       
    77 	};
       
    78 
       
    79 
       
    80 
       
    81 
       
    82 
       
    83 /**
       
    84  * Stack water mark parameters
       
    85  */
       
    86 struct TMemSpyDriverStackWatermarkParams
       
    87     {
       
    88     TUint8* iStackDataAddress;
       
    89     TInt iStackDataLength;
       
    90     TRequestStatus* iStatus;
       
    91     TLinAddr iUserStackPointer;
       
    92     };
       
    93 
       
    94 
       
    95 
       
    96 
       
    97 /**
       
    98  * Stack information block.
       
    99  */
       
   100 class TMemSpyDriverStackInfo
       
   101 	{
       
   102 public:
       
   103     TUint iUserStackPointer;
       
   104 	TUint32 iUserStackBase;
       
   105 	TInt iUserStackSize;
       
   106     TUint32 iUserStackHighWatermark;
       
   107     //
       
   108     TUint iSupervisorStackPointer;
       
   109 	TUint32 iSupervisorStackBase;
       
   110 	TInt iSupervisorStackSize;
       
   111     TUint32 iSupervisorStackHighWatermark;
       
   112 	};
       
   113 
       
   114 
       
   115 /**
       
   116  * Basic thread information block
       
   117  */
       
   118 class TMemSpyDriverThreadInfoBase
       
   119 	{
       
   120 public:
       
   121     // Registers
       
   122     TMemSpyDriverRegSet iCpu;
       
   123     
       
   124     // Stack
       
   125     TMemSpyDriverStackInfo iStackInfo;
       
   126     
       
   127     // User thread framework
       
   128 	RAllocator* iAllocator;
       
   129     CActiveScheduler* iScheduler;
       
   130 	};
       
   131 
       
   132 
       
   133 /**
       
   134  * Thread information block.
       
   135  */
       
   136 class TMemSpyDriverThreadInfo : public TMemSpyDriverThreadInfoBase
       
   137 	{
       
   138 public:
       
   139 	TFullName iFullName;
       
   140  
       
   141     // Basic properties
       
   142 	TUint iPid;
       
   143     TThreadPriority iThreadPriority;
       
   144 
       
   145     // Exit information
       
   146 	TInt iExitReason;
       
   147     TExitType iExitType;
       
   148     TExitCategoryName iExitCategory;
       
   149 	};
       
   150 
       
   151 
       
   152 /**
       
   153  * Process information block.
       
   154  */
       
   155 class TMemSpyDriverProcessInfo
       
   156     {
       
   157 public:
       
   158     inline TUint32 SID() const { return iSecurityInfo.iSecureId; }
       
   159     inline TUint32 VID() const { return iSecurityInfo.iVendorId; }
       
   160 
       
   161 public:
       
   162     TUidType iUids;
       
   163     TUint32 iFlags;
       
   164     TInt iGeneration;
       
   165     TInt iPriority;
       
   166     SSecurityInfo iSecurityInfo;
       
   167     };
       
   168 
       
   169 
       
   170 /** 
       
   171  * Code Segment Information Block 
       
   172  */
       
   173 class TMemSpyDriverCodeSegInfo
       
   174 	{
       
   175 public:
       
   176     inline TMemSpyDriverCodeSegInfo()
       
   177         : iSize( 0 )
       
   178         {
       
   179         }
       
   180 
       
   181 public:
       
   182     TUint32 iSize;
       
   183     TCodeSegCreateInfo iCreateInfo;
       
   184     TProcessMemoryInfo iMemoryInfo;
       
   185 	};
       
   186 
       
   187 
       
   188 
       
   189 
       
   190 
       
   191 /**
       
   192  * Generic object related
       
   193  */
       
   194 class TMemSpyDriverHandleInfoGeneric
       
   195     {
       
   196 public: // Supported for all types
       
   197 	TBuf8<KMaxName> iName; // FullName
       
   198     TAny* iHandle;
       
   199     TMemSpyDriverContainerType iType;
       
   200 
       
   201 public: // Type-specific members
       
   202 
       
   203     // For Process, thread, chunk (owning process id), server (owning thread id)
       
   204     TInt iId;
       
   205 
       
   206     // For Chunk, Library
       
   207     TUint32 iSize;
       
   208    
       
   209     // For Semaphore, Mutex, Server
       
   210     TInt iCount;
       
   211 
       
   212     // For Mutex
       
   213     TInt iWaitCount;
       
   214 
       
   215     // For Server, Session
       
   216     TIpcSessionType iSessionType;
       
   217 
       
   218     // For Timer
       
   219     TMemSpyDriverTimerType iTimerType;
       
   220     TMemSpyDriverTimerState iTimerState;
       
   221 
       
   222     // For Logical channel
       
   223     TInt iOpenChannels;
       
   224     
       
   225     // For most of the object types
       
   226 	TBuf8<KMaxName> iNameDetail; // Name
       
   227     TInt iAccessCount;
       
   228     TInt iUniqueID;
       
   229     TUint iProtection;
       
   230     TUint8* iAddressOfKernelOwner;
       
   231     TInt iPriority;
       
   232     TUint8* iAddressOfOwningProcess;
       
   233     TUint iCreatorId;
       
   234     TUint iSecurityZone;
       
   235     TInt iAttributes;
       
   236     TUint8* iAddressOfDataBssStackChunk;
       
   237 
       
   238     // For Server, Session
       
   239     TUint8* iAddressOfOwningThread;
       
   240     TUint8* iAddressOfServer;
       
   241     TUint16 iTotalAccessCount;
       
   242     TUint8 iSvrSessionType;
       
   243     TInt iMsgCount;
       
   244     TInt iMsgLimit;
       
   245     
       
   246     // For chunk
       
   247     TInt iMaxSize;
       
   248     TInt iBottom;
       
   249     TInt iTop;
       
   250     TInt iStartPos;
       
   251     TUint iControllingOwner;
       
   252     TUint iRestrictions;
       
   253     TUint iMapAttr;
       
   254     TUint iChunkType;
       
   255     TBuf8<KMaxName> iNameOfOwner; // chunk, server
       
   256     
       
   257     // For library
       
   258     TInt iMapCount;
       
   259     TUint8 iState;
       
   260     TUint8* iAddressOfCodeSeg;
       
   261     
       
   262     // Semaphore, mutex, condvar
       
   263     TUint8 iResetting;
       
   264     TUint8 iOrder;
       
   265     
       
   266     // For Logical/Physical device
       
   267     TVersion iVersion;
       
   268     TUint iParseMask;
       
   269     TUint iUnitsMask;
       
   270     
       
   271     // For change notifier
       
   272     TUint iChanges;
       
   273     };
       
   274 
       
   275 
       
   276 
       
   277 /**
       
   278  *
       
   279  */
       
   280 class TMemSpyDriverServerSessionInfo
       
   281     {
       
   282 public: // Enumerations
       
   283     enum TOwnerType
       
   284         {
       
   285         EOwnerNone = -1,
       
   286         EOwnerThread = 0,
       
   287         EOwnerProcess
       
   288         };
       
   289 
       
   290 public:
       
   291     TInt iOwnerId;
       
   292     TOwnerType iOwnerType;
       
   293     TBuf8<KMaxName> iName;
       
   294     TIpcSessionType iSessionType;
       
   295     TUint8* iAddress;
       
   296     };
       
   297 
       
   298 
       
   299 
       
   300 /**
       
   301  *
       
   302  */
       
   303 class TMemSpyDriverProcessInspectionInfo
       
   304     {
       
   305 public:
       
   306     inline TMemSpyDriverProcessInspectionInfo()
       
   307         : iProcessId( 0 ),
       
   308           iMemoryHeap( 0 ),
       
   309           iMemoryStack( 0 ),
       
   310           iMemoryGlobalData( 0 ),
       
   311           iMemoryChunkLocal( 0 ),
       
   312           iMemoryChunkShared( 0 )
       
   313         {
       
   314         }
       
   315 
       
   316 public: // API
       
   317     inline TUint32 TotalIncShared() const
       
   318         {
       
   319         const TUint32 ret = TotalExcShared() + iMemoryChunkShared;
       
   320         return ret;
       
   321         }
       
   322 
       
   323     inline TUint32 TotalExcShared() const
       
   324         {
       
   325         const TUint32 ret = iMemoryHeap + iMemoryStack + iMemoryChunkLocal + iMemoryGlobalData;
       
   326         return ret;
       
   327         }
       
   328 
       
   329 public:
       
   330     TUint32 iProcessId;
       
   331     //
       
   332     TUint32 iMemoryHeap;
       
   333     TUint32 iMemoryStack;
       
   334     TUint32 iMemoryGlobalData;
       
   335     TUint32 iMemoryChunkLocal;
       
   336     TUint32 iMemoryChunkShared;
       
   337     //
       
   338     TInt64 iTime;
       
   339     };
       
   340 
       
   341 
       
   342 
       
   343 
       
   344 
       
   345 
       
   346 class TMemSpyHeapInfo
       
   347     {
       
   348 public: // Enumerations
       
   349     enum THeapImplementationType
       
   350         {
       
   351         ETypeUnknown = 0,
       
   352         ETypeRHeap = 1,
       
   353 		ETypeRHybridHeap = 2,
       
   354         };
       
   355 
       
   356 public: // Constructor & destructor
       
   357     inline TMemSpyHeapInfo()
       
   358         {
       
   359         }
       
   360 
       
   361 public: // API
       
   362     inline void SetType( THeapImplementationType aType ) { iType = aType; }
       
   363     inline THeapImplementationType Type() const { return iType; }
       
   364     //
       
   365     inline TMemSpyHeapInfoRHeap& AsRHeap() { return iRHeap; }
       
   366     inline const TMemSpyHeapInfoRHeap& AsRHeap() const { return iRHeap; }
       
   367     //
       
   368     inline void SetTid( TUint32 aId ) { iTid = aId; }
       
   369     inline TUint32 Tid() const { return iTid; }
       
   370     //
       
   371     inline void SetPid( TUint32 aId ) { iPid = aId; }
       
   372     inline TUint32 Pid() const { return iPid; }
       
   373 
       
   374 private: // Data members
       
   375     THeapImplementationType iType;
       
   376     TMemSpyHeapInfoRHeap iRHeap;
       
   377     TUint32 iPid;
       
   378     TUint32 iTid;
       
   379     };
       
   380 
       
   381 
       
   382 
       
   383 
       
   384 
       
   385 
       
   386 /**
       
   387  * Chunk info base class
       
   388  */
       
   389 class TMemSpyDriverChunkInfoWithoutName
       
   390     {
       
   391 public:
       
   392     inline TMemSpyDriverChunkInfoWithoutName()
       
   393         : iHandle( NULL ),
       
   394           iBaseAddress( NULL ),
       
   395           iSize( 0 ),
       
   396           iMaxSize( 0 ),
       
   397           iOwnerId( 0 ),
       
   398           iType( EMemSpyDriverChunkTypeUnknown )
       
   399         {
       
   400         }
       
   401 
       
   402 public:
       
   403     TAny* iHandle;
       
   404 	TAny* iBaseAddress;
       
   405 	TUint iSize;
       
   406 	TUint iMaxSize;
       
   407 	TUint iOwnerId;
       
   408     TMemSpyDriverChunkType iType;
       
   409     TInt iAttributes;
       
   410     };
       
   411 
       
   412 
       
   413 /**
       
   414  * Chunk info 
       
   415  */
       
   416 class TMemSpyDriverChunkInfo : public TMemSpyDriverChunkInfoWithoutName
       
   417     {
       
   418 public:
       
   419     inline TMemSpyDriverChunkInfo()
       
   420         : TMemSpyDriverChunkInfoWithoutName(),
       
   421           iName( KNullDesC )
       
   422         {
       
   423         }
       
   424 
       
   425 public:
       
   426 	TFullName iName;
       
   427     };
       
   428 
       
   429 
       
   430 /**
       
   431  * cell information
       
   432  */
       
   433 class TMemSpyDriverFreeCell
       
   434 	{
       
   435 public:
       
   436 	TMemSpyDriverCellType iType;
       
   437 	TAny* iAddress;
       
   438 	TInt iLength;
       
   439 	};
       
   440 
       
   441 // For compatibility I can't change TMemSpyDriverCell to be the class and typdef/derive TMemSpyDriverFreeCell. Sigh...
       
   442 typedef TMemSpyDriverFreeCell TMemSpyDriverCell;
       
   443 
       
   444 
       
   445 /** 
       
   446  * P&S information
       
   447  */
       
   448 class TMemSpyDriverPAndSInfo
       
   449     {
       
   450 public:
       
   451     RProperty::TType iType;
       
   452     TUint iCategory;
       
   453     TUint iKey;
       
   454     TInt iRefCount;
       
   455     TUint32 iTid;
       
   456     TUint32 iCreatorSID;
       
   457     };
       
   458 
       
   459 
       
   460 /**
       
   461  * CondVar suspended thread information
       
   462  */
       
   463 class TMemSpyDriverCondVarSuspendedThreadInfo
       
   464     {
       
   465 public:
       
   466     TBuf8<KMaxName> iName;
       
   467     TUint8* iAddress;
       
   468     };
       
   469 
       
   470 #endif