kernel/eka/include/sm_debug_api.h
changeset 259 57b9594f5772
parent 90 947f0dc9f7a8
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    21 */
    21 */
    22 
    22 
    23 #ifndef D_STOP_MODE_API_H
    23 #ifndef D_STOP_MODE_API_H
    24 #define D_STOP_MODE_API_H
    24 #define D_STOP_MODE_API_H
    25 
    25 
    26 #include <rm_debug_api.h>
       
    27 #include <plat_priv.h>
    26 #include <plat_priv.h>
       
    27 #include <e32cmn.h>
       
    28 #include <e32def_private.h>
       
    29 
    28 
    30 
    29 namespace Debug
    31 namespace Debug
    30 	{
    32     {
       
    33 
       
    34 
       
    35 /** This is the maximum size in bytes a user trace can be */
       
    36 const TInt TUserTraceSize = 256;
       
    37 
       
    38 /**
       
    39   Information in the debug functionality block is represented as a concatenation
       
    40   of pairs of TTagHeader structures and arrays of TTag objects.
       
    41   @see TTagHeader
       
    42   @see RSecuritySvrSession::GetDebugFunctionality
       
    43   */
       
    44 struct TTag
       
    45 {
       
    46     /** Tag ID, value identifying this tag. */
       
    47     TUint32 iTagId;
       
    48     /**
       
    49       Values correspond to TTagType enumerators.
       
    50       @see TTagType
       
    51       */
       
    52     TUint16 iType;
       
    53     /** Size of external data associated with this tag. */
       
    54     TUint16 iSize;
       
    55     /** Data associated with this tag. */
       
    56     TUint32 iValue;
       
    57 };
       
    58 
       
    59 /**
       
    60   Enumeration defining the supported tag types. These enumerators are used in TTag.iTagId.
       
    61   @see TTag
       
    62   */
       
    63 enum TTagType
       
    64 {
       
    65     /** Indicates that the iValue field of a TTag structure will contain either ETrue or EFalse. */
       
    66     ETagTypeBoolean = 0,
       
    67     /** Indicates that the iValue field of a TTag structure will contain a value in the TUint32 range. */
       
    68     ETagTypeTUint32 = 1,
       
    69     /** Indicates that the iValue field of a TTag structure will contain values from an enumeration. */
       
    70     ETagTypeEnum = 2,
       
    71     /** Indicates that the iValue field of a TTag structure should be interpreted as a bit field. */
       
    72     ETagTypeBitField = 3,
       
    73     /** Indicates that the type of the iValue field of a TTag structure is unknown. */
       
    74     ETagTypeUnknown = 4,
       
    75     /** Indicates that the iValue field of a TTag structure will contain a pointer. */
       
    76     ETagTypePointer = 5
       
    77 };
       
    78 
       
    79 /**
       
    80   Information in the debug functionality block is represented as a concatenation
       
    81   of pairs of TTagHeader structures and arrays of TTag objects.
       
    82   @see TTag
       
    83   @see RSecuritySvrSession::GetDebugFunctionality
       
    84   */
       
    85 struct TTagHeader
       
    86 {
       
    87     /** Value identifying the contents of this TTagHeader, should be interpreted as an enumerator from TTagHeaderId.
       
    88       @see TTagHeaderId
       
    89       */
       
    90     TUint16 iTagHdrId;
       
    91     /** The number of TTag elements in the array associated with this TTagHeader. */
       
    92     TUint16 iNumTags;
       
    93 };
       
    94 
       
    95 /**
       
    96   Enumeration used to identify TTagHeader structures, TTagHeader::iTagHdrId elements take these enumerators as values.
       
    97   @see TTagHeader
       
    98   */
       
    99 enum TTagHeaderId
       
   100 {
       
   101     ETagHeaderIdCore = 0,            /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityCore. */
       
   102     ETagHeaderIdMemory = 1,          /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityMemory. */
       
   103     /**
       
   104       Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityRegister.
       
   105       These values are defined as in the document Symbian Core Dump File Format Appendix C
       
   106       (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc).
       
   107       The TTag objects in the associated array have an iSize value corresponding to the size of the register's data in bytes.
       
   108       */
       
   109     ETagHeaderIdRegistersCore = 2,
       
   110     /**
       
   111       Identifies a TTagHeader with associated TTag elements with iTagId values corresponding to coprocessor register identifiers.
       
   112       Coprocessor registers are defined as in the document Symbian Core Dump File Format Appendix C as follows
       
   113       (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc):
       
   114 
       
   115       For each 32-bit data word defining a co-pro register, the definition of the meaning of the bits follows
       
   116       the ARM Architecture Reference manual instruction coding
       
   117 
       
   118       Upper Halfword    Lower Halfword
       
   119       Opcode 2          CRm
       
   120 
       
   121       For example: The Domain Access Control Register is Register 3 of co-processor 15. The encoding is therefore
       
   122       CRm = 3
       
   123       Opcode2 = 0
       
   124 
       
   125       Therefore the functionality tag would be:
       
   126       TagID:  15            // co-processor number
       
   127       Type: ETagTypeTUint32
       
   128       Data: 0x00000003      // Opcode2 = 0, CRm = 3
       
   129       */
       
   130     ETagHeaderIdCoProRegisters = 3,  /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityRegister. */
       
   131     ETagHeaderIdBreakpoints = 4,     /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityBreakpoint. */
       
   132     ETagHeaderIdStepping = 5,        /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityStep. */
       
   133     ETagHeaderIdExecution = 6,       /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityExec. */
       
   134     ETagHeaderIdEvents = 7,          /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TEventType. */
       
   135     ETagHeaderIdApiConstants = 8,    /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityApiConstants.*/
       
   136     ETagHeaderList = 9,              /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TListId. */
       
   137     ETagHeaderIdKillObjects = 10,    /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityKillObject. */
       
   138     ETagHeaderIdSecurity = 11,       /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalitySecurity */
       
   139     ETagHeaderIdBuffers = 12,        /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TBufferType. */
       
   140     ETagHeaderIdStopModeFunctions = 13, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityStopModeFunctions. */  
       
   141 };
       
   142 
       
   143 /**
       
   144   This structure is not used in the run-mode debug API.
       
   145   @deprecated
       
   146   */
       
   147 struct TSubBlock
       
   148 {
       
   149     /** Header to identify the TSubBlock. */
       
   150     TTagHeader iHeader;
       
   151     /** Pointer to array of TTag values associated with this TSubBlock. */
       
   152     TTag* iTagArray;
       
   153 };
       
   154 
       
   155 /**
       
   156   These tags define what kinds of core functionality are supported by the run-mode debug subsystem.
       
   157   TTag structures associated with the ETagHeaderIdCore sub-block will have iTagId values from this enumeration.
       
   158   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   159   */
       
   160 enum TFunctionalityCore
       
   161 {
       
   162     ECoreEvents = 0,        /**< Indicates whether events processing is supported. */
       
   163     ECoreStartStop = 1,     /**< Indicates whether suspending and resuming threads is supported. */
       
   164     ECoreMemory = 2,        /**< Indicates whether reading and writing memory is supported. */
       
   165     ECoreRegister = 3,      /**< Indicates whether reading and writing register values is supported. */
       
   166     ECoreBreakpoint = 4,    /**< Indicates whether breakpoints are supported. */
       
   167     ECoreStepping = 5,      /**< Indicates whether stepping is supported. */
       
   168     ECoreLists = 6,         /**< Indicates whether listings are supported. */
       
   169     ECoreLogging = 7,       /**< Indicates whether logging is supported. */
       
   170     ECoreHardware = 8,      /**< Indicates whether hardware support is supported. */
       
   171     ECoreApiConstants = 9,  /**< Indicates whether the information in the ETagHeaderIdApiConstants sub-block is relevant. */
       
   172     ECoreKillObjects = 10,  /**< Indicates whether killing objects (i.e. threads and processes) is supported. */
       
   173     ECoreSecurity = 11,     /**< Indicates whether OEM Debug token support or other security info is supported. */
       
   174     ECoreStopModeFunctions = 12, /**< Indicates whether Stop Mode function calling is supported. */
       
   175     ECoreStopModeBuffers = 13, /**< Indicates whether Stop Mode buffers are supported. */
       
   176     
       
   177     /**
       
   178       @internalTechnology
       
   179       A debug agent should find the number of core tags from the DFBlock rather than this enumerator.
       
   180       */
       
   181     ECoreLast
       
   182 };
       
   183 
       
   184 /**
       
   185   These tags define what kind of memory operations can be performed.
       
   186   TTag structures associated with the ETagHeaderIdMemory sub-block will have iTagId values from this enumeration.
       
   187   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   188  */
       
   189 enum TFunctionalityMemory
       
   190 {
       
   191     EMemoryRead = 0,          /**< Indicates whether reading memory is supported. */
       
   192     EMemoryWrite = 1,         /**< Indicates whether writing memory is supported. */
       
   193     EMemoryAccess64 = 2,      /**< Indicates whether 64 bit memory access is supported. */
       
   194     EMemoryAccess32 = 3,      /**< Indicates whether 32 bit memory access is supported. */
       
   195     EMemoryAccess16 = 4,      /**< Indicates whether 16 bit memory access is supported. */
       
   196     EMemoryAccess8 = 5,       /**< Indicates whether 8 bit memory access is supported. */
       
   197     EMemoryBE8 = 6,           /**< Indicates whether reading memory as 8 bit big-endian values is supported. */
       
   198     EMemoryBE32 = 7,          /**< Indicates whether reading memory as 32 bit big-endian values is supported. */
       
   199     EMemoryLE8 = 8,           /**< Indicates whether reading memory as 8 bit little-endian values is supported. */
       
   200     EMemoryMaxBlockSize = 9,  /**< Corresponds to the maximum size of a block of memory which can be requested. */
       
   201     /**
       
   202       @internalTechnology
       
   203       A debug agent should find the number of memory tags from the DFBlock rather than this enumerator.
       
   204       */
       
   205     EMemoryLast
       
   206 };
       
   207 
       
   208 /**
       
   209   These tags define which objects can be killed by the device driver.
       
   210   TTag structures associated with the ETagHeaderIdKillObjects sub-block will have iTagId values from this enumeration.
       
   211   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   212  */
       
   213 enum TFunctionalityKillObject
       
   214 {
       
   215     EFunctionalityKillThread = 0,          /**< Indicates whether killing threads is supported. */
       
   216     EFunctionalityKillProcess = 1,         /**< Indicates whether killing processes is supported. */
       
   217     /**
       
   218       @internalTechnology
       
   219       A debug agent should find the number of kill object tags from the DFBlock rather than this enumerator.
       
   220       */
       
   221     EFunctionalityKillObjectLast
       
   222 };
       
   223 
       
   224 /**
       
   225   A TTag with an id from the TFunctionalityRegister enum will have a value from this enumeration.
       
   226   The values define how a register can be accessed, if at all.
       
   227  */
       
   228 enum TFunctionalityAccess
       
   229 {
       
   230     EAccessNone = 0,       /**< Indicates that a register cannot be accessed. */
       
   231     EAccessReadOnly = 1,   /**< Indicates that a register can be read, but not written to. */
       
   232     EAccessWriteOnly = 2,  /**< Indicates that a register can be written to, but not read. */
       
   233     EAccessReadWrite = 3,  /**< Indicates that a register can be both read and written to. */
       
   234     EAccessUnknown = 4,    /**< Indicates that it is unspecified whether reading or writing to a register is possible. */
       
   235 };
       
   236 
       
   237 /**
       
   238   These enumerators act as core register identifiers.
       
   239   TTag structures associated with the ETagHeaderIdRegistersCore sub-block will have iTagId values from this enumeration.
       
   240   The numeric value of each enumerator identifies the register according to the definitions in the Symbian Core Dump File Format Appendix B
       
   241   (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc).
       
   242   */
       
   243 enum TFunctionalityRegister
       
   244 {
       
   245     ERegisterR0 = 0x00000000,      /**< Identifier for user mode register R0. */
       
   246     ERegisterR1 = 0x00000100,      /**< Identifier for user mode register R1. */
       
   247     ERegisterR2 = 0x00000200,      /**< Identifier for user mode register R2. */
       
   248     ERegisterR3 = 0x00000300,      /**< Identifier for user mode register R3. */
       
   249     ERegisterR4 = 0x00000400,      /**< Identifier for user mode register R4. */
       
   250     ERegisterR5 = 0x00000500,      /**< Identifier for user mode register R5. */
       
   251     ERegisterR6 = 0x00000600,      /**< Identifier for user mode register R6. */
       
   252     ERegisterR7 = 0x00000700,      /**< Identifier for user mode register R7. */
       
   253     ERegisterR8 = 0x00000800,      /**< Identifier for user mode register R8. */
       
   254     ERegisterR9 = 0x00000900,      /**< Identifier for user mode register R9. */
       
   255     ERegisterR10 = 0x00000a00,     /**< Identifier for user mode register R10. */
       
   256     ERegisterR11 = 0x00000b00,     /**< Identifier for user mode register R11. */
       
   257     ERegisterR12 = 0x00000c00,     /**< Identifier for user mode register R12. */
       
   258     ERegisterR13 = 0x00000d00,     /**< Identifier for user mode register R13. */
       
   259     ERegisterR14 = 0x00000e00,     /**< Identifier for user mode register R14. */
       
   260     ERegisterR15 = 0x00000f00,     /**< Identifier for user mode register R15. */
       
   261     ERegisterCpsr = 0x00001000,    /**< Identifier for CPSR. */
       
   262     ERegisterR13Svc = 0x00001100,  /**< Identifier for R13 supervisor mode banked register. */
       
   263     ERegisterR14Svc = 0x00001200,  /**< Identifier for R14 supervisor mode banked register. */
       
   264     ERegisterSpsrSvc = 0x00001300, /**< Identifier for SPSR supervisor mode banked register. */
       
   265     ERegisterR13Abt = 0x00001400,  /**< Identifier for R13 Abort mode banked register. */
       
   266     ERegisterR14Abt = 0x00001500,  /**< Identifier for R14 Abort mode banked register. */
       
   267     ERegisterSpsrAbt = 0x00001600, /**< Identifier for SPSR Abort mode banked register. */
       
   268     ERegisterR13Und = 0x00001700,  /**< Identifier for R13 Undefined mode banked register. */
       
   269     ERegisterR14Und = 0x00001800,  /**< Identifier for R14 Undefined mode banked register. */
       
   270     ERegisterSpsrUnd = 0x00001900, /**< Identifier for SPSR Undefined mode banked register. */
       
   271     ERegisterR13Irq = 0x00001a00,  /**< Identifier for R13 Interrupt mode banked register. */
       
   272     ERegisterR14Irq = 0x00001b00,  /**< Identifier for R14 Interrupt mode banked register. */
       
   273     ERegisterSpsrIrq = 0x00001c00, /**< Identifier for SPSR Interrupt mode banked register. */
       
   274     ERegisterR8Fiq = 0x00001d00,   /**< Identifier for R8 Fast Interrupt mode banked register. */
       
   275     ERegisterR9Fiq = 0x00001e00,   /**< Identifier for R9 Fast Interrupt mode banked register. */
       
   276     ERegisterR10Fiq = 0x00001f00,  /**< Identifier for R10 Fast Interrupt mode banked register. */
       
   277     ERegisterR11Fiq = 0x00002000,  /**< Identifier for R11 Fast Interrupt mode banked register. */
       
   278     ERegisterR12Fiq = 0x00002100,  /**< Identifier for R12 Fast Interrupt mode banked register. */
       
   279     ERegisterR13Fiq = 0x00002200,  /**< Identifier for R13 Fast Interrupt mode banked register. */
       
   280     ERegisterR14Fiq = 0x00002300,  /**< Identifier for R14 Fast Interrupt mode banked register. */
       
   281     ERegisterSpsrFiq = 0x00002400, /**< Identifier for SPSR Fast Interrupt mode banked register. */
       
   282     /**
       
   283       @internalTechnology
       
   284       A debug agent should find the number of core registers from the DFBlock rather than this enumerator.
       
   285       */
       
   286     ERegisterLast = 37
       
   287 };
       
   288 
       
   289 
       
   290 /**
       
   291   These tags define the kind of breakpoints that are supported.
       
   292   TTag structures associated with the ETagHeaderIdBreakpoints sub-block will have iTagId values from this enumeration.
       
   293   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   294  */
       
   295 enum TFunctionalityBreakpoint
       
   296 {
       
   297     EBreakpointThread = 0,         /**< Indicates whether thread specific breakpoints are supported. */
       
   298     EBreakpointProcess = 1,        /**< Indicates whether process specific breakpoints are supported. */
       
   299     EBreakpointSystem = 2,         /**< Indicates whether system wide breakpoints are supported. */
       
   300     EBreakpointArm = 3,            /**< Indicates whether ARM mode breakpoints are supported. */
       
   301     EBreakpointThumb = 4,          /**< Indicates whether Thumb mode breakpoints are supported. */
       
   302     EBreakpointT2EE = 5,           /**< Indicates whether Thumb2 mode breakpoints are supported. */
       
   303     EBreakpointArmInst = 6,        /**< Reserved for future use. */
       
   304     EBreakpointThumbInst = 7,      /**< Reserved for future use. */
       
   305     EBreakpointT2EEInst = 8,       /**< Reserved for future use. */
       
   306     EBreakpointSetArmInst = 9,     /**< Reserved for future use. */
       
   307     EBreakpointSetThumbInst = 10,  /**< Reserved for future use. */
       
   308     EBreakpointSetT2EEInst = 11,   /**< Reserved for future use. */
       
   309     /**
       
   310       @internalTechnology
       
   311       A debug agent should find the number of breakpoint tags from the DFBlock rather than this enumerator.
       
   312       */
       
   313     EBreakpointLast
       
   314 };
       
   315 
       
   316 /**
       
   317   These enumerators provide information about the stepping capabilities of the debug sub-system.
       
   318   TTag structures associated with the ETagHeaderIdStepping sub-block will have iTagId values from this enumeration.
       
   319   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   320  */
       
   321 enum TFunctionalityStep
       
   322 {
       
   323     EStep = 0, /**< Indicates whether instruction stepping is supported. */
       
   324     /**
       
   325       @internalTechnology
       
   326       A debug agent should find the number of stepping tags from the DFBlock rather than this enumerator.
       
   327       */
       
   328     EStepLast
       
   329 };
       
   330 
       
   331 /**
       
   332   These enumerators provide information about the execution control capabilities of the debug sub-system.
       
   333   TTag structures associated with the ETagHeaderIdExecution sub-block will have iTagId values from this enumeration.
       
   334   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   335  */
       
   336 enum TFunctionalityExec
       
   337 {
       
   338     EExecThreadSuspendResume = 0,  /**< Indicates whether suspending and resuming threads is supported. */
       
   339     EExecProcessSuspendResume = 1, /**< Indicates whether suspending and resuming processes is supported. */
       
   340     EExecSystemSuspendResume = 2,  /**< Indicates whether suspending and resuming the entire system is supported. */
       
   341     /**
       
   342       @internalTechnology
       
   343       A debug agent should find the number of execution control tags from the DFBlock rather than this enumerator.
       
   344       */
       
   345     EExecLast
       
   346 };
       
   347 
       
   348 /**
       
   349   This enumeration defines the event types supported by the debug sub-system.
       
   350   TTag structures associated with the ETagHeaderIdEvents sub-block will have
       
   351   iTagId values from this enumeration, and iValue values from the TKernelEventAction enumeration.
       
   352 
       
   353   These enumerators are also used by the RSecuritySvrSession API to identify events.
       
   354   @see RSecuritySvrSession
       
   355   @see TKernelEventAction
       
   356  */
       
   357 enum TEventType
       
   358 {
       
   359     EEventsBreakPoint = 0,    /**< Identifies a breakpoint event. */
       
   360     EEventsSwExc = 1,         /**< Identifies a software exception event. */
       
   361     EEventsHwExc = 2,         /**< Identifies a hardware exception event. */
       
   362     EEventsKillThread = 3,    /**< Identifies a kill thread event. */
       
   363     EEventsAddLibrary = 4,    /**< Identifies an add library event. */
       
   364     EEventsRemoveLibrary = 5, /**< Identifies a remove library event. */
       
   365     /**
       
   366      If an event is generated and there is only a single space remaining in the events queue then
       
   367      an event of type EEventsBufferFull will be stored in the queue and the generated event will
       
   368      be discarded. If further events occur while the buffer is full the events will be discarded.
       
   369      As such an event of type EEventsBufferFull being returned signifies that one or more events
       
   370      were discarded. An event of this type has no valid data associated with it.
       
   371      */
       
   372     EEventsBufferFull = 6,
       
   373     EEventsUnknown = 7,       /**< Identifies an event of unknown type. */
       
   374     EEventsUserTrace = 8,     /**< Identifies a user trace. */
       
   375     EEventsProcessBreakPoint = 9, /**< Identifies a process breakpoint event. */
       
   376     EEventsStartThread = 10, /**< Identifies a start thread event. */
       
   377     EEventsUserTracesLost = 11, /**< Identifies user traces being lost. */
       
   378     EEventsAddProcess = 12, /**< Identifies an AddProcess event */
       
   379     EEventsRemoveProcess = 13, /**< Identifies a RemoveProcess event */
       
   380     /**
       
   381       @internalTechnology
       
   382       A debug agent should find the number of event types from the DFBlock rather than this enumerator.
       
   383       */
       
   384     EEventsLast
       
   385 };
       
   386 
       
   387 /**
       
   388   These enumerators provide information about constants which are used in the RSecuritySvrSession API.
       
   389   TTag structures associated with the ETagHeaderIdApiConstants sub-block will have iTagId values from this enumeration.
       
   390   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   391  */
       
   392 enum TFunctionalityApiConstants
       
   393     {
       
   394     /**
       
   395       Corresponds to the size of a buffer required to store a TEventInfo.
       
   396       @see TEventInfo
       
   397       */
       
   398     EApiConstantsTEventInfoSize = 0,
       
   399     /**
       
   400       @internalTechnology
       
   401       A debug agent should find the number of API constants tags from the DFBlock rather than this enumerator.
       
   402       */
       
   403     EApiConstantsLast,
       
   404     };
       
   405 
       
   406 /**
       
   407   The set of possible actions which could be taken when a kernel event occurs.
       
   408   Not all actions are possible for all events. The debug functionality sub-block with header id ETagHeaderIdEvents
       
   409   indicates which values are permitted for each event. The value given for that event should be
       
   410   considered as the most intrusive action the debugger may set: with the definition that EActionSuspend is more
       
   411   intrusive than EActionContinue, which is more intrusive than EActionIgnore.
       
   412   @see RSecuritySvrSession
       
   413   */
       
   414 enum TKernelEventAction
       
   415 {
       
   416     /** If an event action is set to this value then events of that type will be
       
   417       ignored, and not reported to the debugger. */
       
   418     EActionIgnore = 0,
       
   419     /** If an event action is set to this value then events of that type will be
       
   420       reported to the debugger and the thread which generated the event will be
       
   421       allowed to continue executing. */
       
   422     EActionContinue = 1,
       
   423     /** If an event action is set to this value then events of that type will be
       
   424       reported to the debugger and the thread which generated the event will be
       
   425       suspended. */
       
   426     EActionSuspend = 2,
       
   427     /**
       
   428       @internalTechnology
       
   429       Count of event actions.
       
   430       */
       
   431     EActionLast
       
   432 };
       
   433 
       
   434 /**
       
   435   These enumerators provide information about the ability of the debug subsystem to support OEM Debug tokens.
       
   436   TTag structures associated with the ETagHeaderIdSecurity sub-block will have iTagId values from this enumeration.
       
   437   See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
       
   438  */
       
   439 enum TFunctionalitySecurity
       
   440 {
       
   441     ESecurityOEMDebugToken = 0,  /**< Indicates whether the DSS supports the use of OEM Debug Tokens. */
       
   442 
       
   443     /**
       
   444       @internalTechnology
       
   445       A debug agent should find the number of tags from the DFBlock rather than this enumerator.
       
   446       */
       
   447     ESecurityLast
       
   448 };
       
   449 
       
   450 /**
       
   451   Used for storing the contents of a 32 bit register
       
   452   */
       
   453 typedef TUint32 TRegisterValue32;
       
   454 
       
   455 
       
   456 /**
       
   457  * Processor mode
       
   458  */
       
   459 enum TArmProcessorModes
       
   460 {
       
   461     EUserMode=0x10,     //!< EUserMode
       
   462     EFiqMode=0x11,      //!< EFiqMode
       
   463     EIrqMode=0x12,      //!< EIrqMode
       
   464     ESvcMode=0x13,      //!< ESvcMode
       
   465     EAbortMode=0x17,    //!< EAbortMode
       
   466     EUndefMode=0x1b,    //!< EUndefMode
       
   467     EMaskMode=0x1f      //!< EMaskMode
       
   468 };
       
   469 
       
   470 
       
   471 
       
   472 /**
       
   473   Structure containing information about the state of the registers when a
       
   474   hardware exception occurred
       
   475   */
       
   476 class TRmdArmExcInfo
       
   477     {
       
   478 public:
       
   479     /** Enumeration detailing the types of exception which may occur. */
       
   480     enum TExceptionType
       
   481         {
       
   482         /** Enumerator signifying that a prefetch abort error has occurred. */
       
   483         EPrefetchAbort = 0,
       
   484         /** Enumerator signifying that a data abort error has occurred. */
       
   485         EDataAbort = 1,
       
   486         /** Enumerator signifying that an undefined instruction error has occurred. */
       
   487         EUndef =2
       
   488         };
       
   489 
       
   490     /** Value of CPSR. */
       
   491     TRegisterValue32 iCpsr;
       
   492     /** Type of exception which has occurred. */
       
   493     TExceptionType iExcCode;
       
   494     /** Value of R13 supervisor mode banked register. */
       
   495     TRegisterValue32 iR13Svc;
       
   496     /** Value of user mode register R4. */
       
   497     TRegisterValue32 iR4;
       
   498     /** Value of user mode register R5. */
       
   499     TRegisterValue32 iR5;
       
   500     /** Value of user mode register R6. */
       
   501     TRegisterValue32 iR6;
       
   502     /** Value of user mode register R7. */
       
   503     TRegisterValue32 iR7;
       
   504     /** Value of user mode register R8. */
       
   505     TRegisterValue32 iR8;
       
   506     /** Value of user mode register R9. */
       
   507     TRegisterValue32 iR9;
       
   508     /** Value of user mode register R10. */
       
   509     TRegisterValue32 iR10;
       
   510     /** Value of user mode register R11. */
       
   511     TRegisterValue32 iR11;
       
   512     /** Value of R14 supervisor mode banked register. */
       
   513     TRegisterValue32 iR14Svc;
       
   514     /** Address which caused exception (System Control Coprocessor Fault Address Register) */
       
   515     TRegisterValue32 iFaultAddress;
       
   516     /** Value of System Control Coprocessor Fault Status Register. */
       
   517     TRegisterValue32 iFaultStatus;
       
   518     /** Value of SPSR supervisor mode banked register. */
       
   519     TRegisterValue32 iSpsrSvc;
       
   520     /** Value of user mode register R13. */
       
   521     TRegisterValue32 iR13;
       
   522     /** Value of user mode register R14. */
       
   523     TRegisterValue32 iR14;
       
   524     /** Value of user mode register R0. */
       
   525     TRegisterValue32 iR0;
       
   526     /** Value of user mode register R1. */
       
   527     TRegisterValue32 iR1;
       
   528     /** Value of user mode register R2. */
       
   529     TRegisterValue32 iR2;
       
   530     /** Value of user mode register R3. */
       
   531     TRegisterValue32 iR3;
       
   532     /** Value of user mode register R12. */
       
   533     TRegisterValue32 iR12;
       
   534     /** Value of user mode register R15, points to instruction which caused exception. */
       
   535     TRegisterValue32 iR15;
       
   536     };
       
   537 
       
   538 /**
       
   539   The maximum size, in bytes, of the panic category string returned as part of a
       
   540   TEventInfo object.
       
   541 
       
   542   @see TEventInfo
       
   543   @see TThreadKillInfo
       
   544   */
       
   545 const TInt KPanicCategoryMaxName = KMaxName;
       
   546 
       
   547 /**
       
   548   Event specific information returned as part of a TEventInfo object when
       
   549   an agent set breakpoint is hit.
       
   550   */
       
   551 class TThreadBreakPointInfo
       
   552     {
       
   553 public:
       
   554     /** Identifies the type of exception. */
       
   555     TExcType iExceptionNumber;
       
   556     /** Structure containing information about the ARM register values. */
       
   557     TRmdArmExcInfo iRmdArmExcInfo;
       
   558     };
       
   559 
       
   560 /**
       
   561   Event specific information returned as part of a TEventInfo object when
       
   562   a software exception occurs.
       
   563   */
       
   564 class TThreadSwExceptionInfo
       
   565     {
       
   566 public:
       
   567     /** The value of the program counter. */
       
   568     TUint32 iCurrentPC;
       
   569     /** Identifies the type of exception. */
       
   570     TExcType iExceptionNumber;
       
   571     };
       
   572 
       
   573 /**
       
   574   Event specific information returned as part of a TEventInfo object when
       
   575   a hardware exception occurs.
       
   576   */
       
   577 class TThreadHwExceptionInfo
       
   578     {
       
   579 public:
       
   580     /** Identifies the type of exception. */
       
   581     TExcType iExceptionNumber;
       
   582     /** Structure containing information about the ARM register values. */
       
   583     TRmdArmExcInfo iRmdArmExcInfo;
       
   584     };
       
   585 
       
   586 /**
       
   587   Event specific information returned as part of a TEventInfo object when
       
   588   a thread kill event occurs.
       
   589   */
       
   590 class TThreadKillInfo
       
   591     {
       
   592 public:
       
   593     /** The value of the program counter. */
       
   594     TUint32 iCurrentPC;
       
   595     /** Specifies the reason for the kill thread event, this value is specific to the killed thread and does not correspond to a standard Symbian enumeration. */
       
   596     TInt iExitReason;
       
   597     /** Specifies the type of the thread kill event, values correspond to elements of TExitType. */
       
   598     TUint8 iExitType;
       
   599     /** The panic category of the killed thread. */
       
   600     TUint8 iPanicCategory[KPanicCategoryMaxName];
       
   601     /** Contains the length in bytes of the initialised data in iPanicCategory. */
       
   602     TInt iPanicCategoryLength;
       
   603     };
       
   604 
       
   605 /**
       
   606   Event specific information returned as part of a TEventInfo object when
       
   607   a library load event occurs.
       
   608   */
       
   609 class TLibraryLoadedInfo
       
   610     {
       
   611 public:
       
   612     /** The name of the file that the library was loaded from. */
       
   613     TUint8 iFileName[KMaxName];
       
   614     /** Contains the length in bytes of the initialised data in iFileName. */
       
   615     TInt iFileNameLength;
       
   616     /** The code base address (.text). */
       
   617     TUint32 iCodeAddress;
       
   618     /** The base address of the initialised data section (.data). */
       
   619     TUint32 iDataAddress;
       
   620     };
       
   621 
       
   622 /**
       
   623   Event specific information returned as part of a TEventInfo object when
       
   624   a thread is started
       
   625   */
       
   626 class TStartThreadInfo
       
   627     {
       
   628 public:
       
   629     /** The name of the file that the process owning the thread was created from. */
       
   630     TUint8 iFileName[KMaxName];
       
   631     /** Contains the length in bytes of the initialised data in iFileName. */
       
   632     TInt iFileNameLength;
       
   633     };
       
   634 
       
   635 /**
       
   636   Event specific information returned as part of a TEventInfo object when
       
   637   a process is added. Note that the Process may not be fully constructed,
       
   638   e.g. no threads.
       
   639   */
       
   640 class TAddProcessInfo
       
   641     {
       
   642 public:
       
   643     /** The name of the file that the process was created from. */
       
   644     TUint8 iFileName[KMaxName];
       
   645     /** Contains the length in bytes of the initialised data in iFileName. */
       
   646     TInt iFileNameLength;
       
   647     /** The UID3 of this process */
       
   648     TUint32 iUid3;  
       
   649     /** Contains the CreatorThread ID if available: May be 0 */
       
   650     TUint64 iCreatorThreadId;  
       
   651     };
       
   652 
       
   653 /**
       
   654   Event specific information returned as part of a TEventInfo object when
       
   655   a process is removed. Note that the Process may not be fully destroyed,
       
   656   so its resources should only be accessed if you already have a handle to it.
       
   657   */
       
   658 class TRemoveProcessInfo
       
   659     {
       
   660 public:
       
   661     /** The name of the file that the process was created from. */
       
   662     TUint8 iFileName[KMaxName];
       
   663     /** Contains the length in bytes of the initialised data in iFileName. */
       
   664     TInt iFileNameLength;
       
   665     TUint32 iSpare1;    // Unused
       
   666     };
       
   667 
       
   668 /**
       
   669   Event specific information returned as part of a TEventInfo object when
       
   670   a library unload event occurs.
       
   671   */
       
   672 class TLibraryUnloadedInfo
       
   673     {
       
   674 public:
       
   675     /** The name of the file that the library was loaded from. */
       
   676     TUint8 iFileName[KMaxName];
       
   677     /** Contains the length in bytes of the initialised data in iFileName. */
       
   678     TInt iFileNameLength;
       
   679     };
       
   680 
       
   681 /**
       
   682  * Enum to represent the context of a user trace message
       
   683  */ 
       
   684 enum TUserTraceMessageContext 
       
   685 {
       
   686     ESingleMessage = 0x1,   /** Indicates this message is the only one corresponding to a given user trace */ 
       
   687     EMultiStart = 0x2, /** Indicates this message is the start of a user trace which consists of multiple messages */
       
   688     EMultiMid = 0x3, /** Indicates this message is one in a series of user trace messages */
       
   689     EMultiEnd = 0x4, /** Indicates this message is the last in a series of user trace messages */
       
   690     /**
       
   691       @internalTechnology
       
   692       A debug agent should find the number of core tags from the DFBlock rather than this enumerator.
       
   693       */
       
   694     ELast = 0x5 
       
   695 };
       
   696     
       
   697 /**
       
   698  *   Event specific information returned as part of a TEventInfo object 
       
   699  *   when a user trace event occurs.
       
   700  */
       
   701 class TUserTraceInfo
       
   702     {
       
   703 public:
       
   704     /** The user trace text */
       
   705     TUint8 iUserTraceText[TUserTraceSize];
       
   706     
       
   707     /** User trace text length */
       
   708     TInt iUserTraceLength;
       
   709     
       
   710     /** The context of the message */
       
   711     TUserTraceMessageContext iMessageStatus;
       
   712     };
       
   713     
       
   714     
       
   715 /**
       
   716   Structure used to store information about an event. An object of this type
       
   717   is passed as an argument to the RSecuritySvrSession::GetEvent function,
       
   718   and is filled in by the debug driver, and returned to the agent, when a
       
   719   relevant event occurs.
       
   720 
       
   721   The debug functionality block contains the size in bytes of the data that
       
   722   the driver will return when a GetEvent call is issued. A debug agent should
       
   723   ensure that this value equals the size of this TEventInfo object to ensure
       
   724   that a compatible debug driver is being used. The value is stored as
       
   725   EApiConstantsTEventInfoSize in the TFunctionalityApiConstants block.
       
   726 
       
   727   @see RSecuritySvrSession::GetDebugFunctionality
       
   728   @see RSecuritySvrSession::GetEvent
       
   729   */
       
   730 class TEventInfo
       
   731     {
       
   732 public:
       
   733 
       
   734     /** Constructor sets all elements to default values. */
       
   735     inline TEventInfo() { Reset(); };
       
   736 
       
   737     /** Resets all values to default values. */
       
   738     inline void Reset()
       
   739         {
       
   740         iProcessId = 0;
       
   741         iProcessIdValid = EFalse;
       
   742         iThreadId = 0;
       
   743         iThreadIdValid = EFalse;
       
   744         iEventType = (TEventType)NULL;
       
   745         };
       
   746 
       
   747 public:
       
   748 
       
   749     /** The process ID of the process which the event occurred in. */
       
   750     TUint64                 iProcessId;
       
   751     /** The thread ID of the thread which the event occurred in. */
       
   752     TUint64                 iThreadId;
       
   753     /** Has value ETrue if iProcessId is valid, EFalse otherwise. */
       
   754     TUint8                  iProcessIdValid;
       
   755     /** Has value ETrue if iThreadId is valid, EFalse otherwise. */
       
   756     TUint8                  iThreadIdValid;
       
   757     /** Indicates the type of the event. This type should be used to determine
       
   758         the type of the information stored in the union which is part of this class. */
       
   759     TEventType              iEventType;
       
   760     union
       
   761         {
       
   762         /** Information which is specific to the break point event. */
       
   763         TThreadBreakPointInfo iThreadBreakPointInfo;
       
   764         /** Information which is specific to the software exception event. */
       
   765         TThreadSwExceptionInfo iThreadSwExceptionInfo;
       
   766         /** Information which is specific to the hardware exception event. */
       
   767         TThreadHwExceptionInfo iThreadHwExceptionInfo;
       
   768         /** Information which is specific to the thread kill event. */
       
   769         TThreadKillInfo iThreadKillInfo;
       
   770         /** Information which is specific to the library loaded event. */
       
   771         TLibraryLoadedInfo iLibraryLoadedInfo;
       
   772         /** Information which is specific to the library unloaded event. */
       
   773         TLibraryUnloadedInfo iLibraryUnloadedInfo;
       
   774         /** Information which is specific to the user trace event. */
       
   775         TUserTraceInfo iUserTraceInfo;
       
   776         /** Information which is specific to the start thread event. */
       
   777         TStartThreadInfo iStartThreadInfo;
       
   778         /** Information which is specific to the Add Process event. */
       
   779         TAddProcessInfo iAddProcessInfo;
       
   780         /** Information which is specific to the Remove Process event. */
       
   781         TRemoveProcessInfo iRemoveProcessInfo;
       
   782         };
       
   783     };
       
   784 
       
   785 /**
       
   786   @internalComponent
       
   787   */
       
   788 class TProcessInfo
       
   789     {
       
   790     public:
       
   791 
       
   792         inline TProcessInfo() { Reset(); }
       
   793 
       
   794         inline TProcessInfo(TUint32 aId, TUint32 aCodeAddress, TUint32 aCodeSize, TUint32 aDataAddress)
       
   795                 : iId(aId),
       
   796                   iCodeAddress(aCodeAddress),
       
   797                   iCodeSize(aCodeSize),
       
   798                   iDataAddress(aDataAddress) { }
       
   799 
       
   800         inline void Reset()
       
   801             {
       
   802             iId = 0;
       
   803             iCodeAddress = 0;
       
   804             iCodeSize = 0;
       
   805             iDataAddress = 0;
       
   806             }
       
   807 
       
   808     public:
       
   809 
       
   810         TUint32 iId;
       
   811         TUint32 iCodeAddress;
       
   812         TUint32 iCodeSize;
       
   813         TUint32 iDataAddress;
       
   814     };
       
   815 
       
   816 /* Other functionality may be defined here later */
       
   817 
       
   818 /**
       
   819 Represents a register id value, in the terms of the Symbian ELF format:
       
   820  - bits 0-7 define the class
       
   821  - bits 8-15 define the rd_id
       
   822  - bits 16-31 define the rd_sub_id
       
   823 
       
   824 Both the core registers (TFunctionalityRegister type) and the coprocessor registers
       
   825 follow this identifier scheme.
       
   826 */
       
   827 typedef TUint32 TRegisterInfo;
       
   828 
       
   829 /**
       
   830 Enum representing the status flags which could be returned from a register
       
   831 access call.
       
   832 */
       
   833 enum TRegisterFlag
       
   834     {
       
   835     /**
       
   836     Default value, a register access call will never return this value
       
   837     */
       
   838     ENotSet = 0,
       
   839     /**
       
   840     Would be returned if the register is supported by the debug driver but the kernel cannot access the register
       
   841     */
       
   842     EInValid = 1,
       
   843     /**
       
   844     Would be returned if the register could be accessed correctly
       
   845     */
       
   846     EValid = 2,
       
   847     /**
       
   848     Would be returned if the register is not supported by the debug driver
       
   849     */
       
   850     ENotSupported = 3,
       
   851     /**
       
   852     Would be returned if a non-4 byte register value was requested
       
   853     */
       
   854     EBadSize = 4
       
   855     };
       
   856 
       
   857 /**
       
   858 Enum representing the different ARM CPU instruction set architectures.
       
   859 */
       
   860 enum TArchitectureMode
       
   861     {
       
   862     /** Represents the ARM CPU architecture. */
       
   863     EArmMode = 1,
       
   864     /** Represents the Thumb CPU architecture. */
       
   865     EThumbMode = 2,
       
   866     /**
       
   867       Represents the Thumb2 CPU architecture.
       
   868       @prototype
       
   869       */
       
   870     EThumb2EEMode = 3
       
   871     };
       
   872 
       
   873 /**
       
   874   Used as an identifier for breakpoints set by the RSecuritySvrSession::SetBreak function.
       
   875   @see RSecuritySvrSession
       
   876   */
       
   877 typedef TInt32 TBreakId;
       
   878 
       
   879 /**
       
   880   Specifies the type of a code segment.
       
   881   @see TCodeSegListEntry
       
   882   */
       
   883 enum TCodeSegType
       
   884     {
       
   885     EUnknownCodeSegType = 0, /**< Signifies an unknown code segment type. */
       
   886     EExeCodeSegType = 1,     /**< Signifies a code segment belonging to an executable. */
       
   887     EDllCodeSegType = 2      /**< Signifies a code segment belonging to a library. */
       
   888     };
       
   889 
       
   890 /**
       
   891 Structure used for extracting data from a descriptor returned by a call to
       
   892 RSecuritySvrSession::GetList() when GetList() is called with TListId::ECodeSegs
       
   893 as the first argument.
       
   894 
       
   895 @see RSecuritySvrSession::GetList()
       
   896 
       
   897 @code
       
   898 //buffer is a TDesC8 containing 4-byte aligned TCodeSegListEntry objects
       
   899 //create a pointer to the start of the data
       
   900 TUint8* ptr = (TUint8*)buffer.Ptr();
       
   901 //create a pointer to the end of the data
       
   902 const TUint8* ptrEnd = ptr + buffer.Length();
       
   903 while(ptr < ptrEnd)
       
   904     {
       
   905     //cast the pointer to be a TCodeSegListEntry object
       
   906     TCodeSegListEntry& entry = *(TCodeSegListEntry*)ptr;
       
   907     //use the TCodeSegListEntry pointer, i.e.
       
   908     TUint16 nameLength = entry.iNameLength;
       
   909     TPtr name(&(entry.iName[0]), nameLength, nameLength);
       
   910     // move ptr on to point to the next TCodeSegListEntry object
       
   911     ptr += Align4(entry.GetSize());
       
   912     }
       
   913 @endcode
       
   914 */
       
   915 class TCodeSegListEntry
       
   916     {
       
   917 public:
       
   918     TInt GetSize() const;
       
   919 public:
       
   920     /**
       
   921       Address of the start of the code segment.
       
   922       */
       
   923     TUint32 iCodeBase;
       
   924     /**
       
   925       Size of the code segment.
       
   926       */
       
   927     TUint32 iCodeSize;
       
   928     /**
       
   929       Size of the const data segment
       
   930       */
       
   931     TUint32 iConstDataSize;
       
   932     /**
       
   933       Address of the initialised data
       
   934       */
       
   935     TUint32 iInitialisedDataBase;
       
   936     /**
       
   937       Size of the initialised data
       
   938       */
       
   939     TUint32 iInitialisedDataSize;
       
   940     /**
       
   941       Size of the uninitialised data
       
   942       */
       
   943     TUint32 iUninitialisedDataSize;
       
   944     /**
       
   945       Boolean indicating whether the code segment is execute in place
       
   946       */
       
   947     TBool iIsXip;
       
   948     /**
       
   949       Indicates whether the code segment is from an executable or a dll, or neither
       
   950       */
       
   951     TCodeSegType iCodeSegType;
       
   952     /** Uid3 of this segment. */
       
   953     TUint32 iUid3;
       
   954     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
   955     TUint32 iSpare2;
       
   956     /**
       
   957       Length of the code segment's name
       
   958       */
       
   959     TUint16 iNameLength;
       
   960     /**
       
   961       First two bytes of the code segment's name, the name should be considered to
       
   962       extend past the end of the TCodeSegListEntry structure to a length
       
   963       corresponding to iNameLength
       
   964       */
       
   965     TUint16 iName[1];
       
   966     };
       
   967 
       
   968 /**
       
   969 Returns the size of the TCodeSegListEntry, including the file name length
       
   970 
       
   971 @return the size, in bytes, of the TCodeSegListEntry and the code segment's
       
   972 file name
       
   973 */
       
   974 inline TInt TCodeSegListEntry::GetSize() const
       
   975     {
       
   976     return sizeof(TCodeSegListEntry) - sizeof(iName) + (2 * iNameLength);
       
   977     }
       
   978 
       
   979 /**
       
   980 Structure used for extracting data from a descriptor returned by a call to
       
   981 RSecuritySvrSession::GetList() when GetList() is called with TListId::EXipLibraries
       
   982 as the first argument.
       
   983 
       
   984 @see RSecuritySvrSession::GetList()
       
   985 
       
   986 @code
       
   987 //buffer is a TDesC8 containing 4-byte aligned TXipLibraryListEntry objects
       
   988 //create a pointer to the start of the data
       
   989 TUint8* ptr = (TUint8*)buffer.Ptr();
       
   990 //create a pointer to the end of the data
       
   991 const TUint8* ptrEnd = ptr + buffer.Length();
       
   992 while(ptr < ptrEnd)
       
   993     {
       
   994     //cast the pointer to be a TXipLibraryListEntry object
       
   995     TXipLibraryListEntry& entry = *(TXipLibraryListEntry*)ptr;
       
   996     //use the TXipLibraryListEntry pointer, i.e.
       
   997     TUint16 nameLength = entry.iNameLength;
       
   998     TPtr name(&(entry.iName[0]), nameLength, nameLength);
       
   999     // move ptr on to point to the next TXipLibraryListEntry object
       
  1000     ptr += Align4(entry.GetSize());
       
  1001     }
       
  1002 @endcode
       
  1003 */
       
  1004 class TXipLibraryListEntry
       
  1005     {
       
  1006 public:
       
  1007     TInt GetSize() const;
       
  1008 public:
       
  1009     /**
       
  1010       Address of the start of the library's code segment.
       
  1011       */
       
  1012     TUint32 iCodeBase;
       
  1013     /**
       
  1014       Size of the code segment.
       
  1015       */
       
  1016     TUint32 iCodeSize;
       
  1017     /**
       
  1018       Size of the const data segment
       
  1019       */
       
  1020     TUint32 iConstDataSize;
       
  1021     /**
       
  1022       Address of the initialised data
       
  1023       */
       
  1024     TUint32 iInitialisedDataBase;
       
  1025     /**
       
  1026       Size of the initialised data
       
  1027       */
       
  1028     TUint32 iInitialisedDataSize;
       
  1029     /**
       
  1030       Size of the uninitialised data
       
  1031       */
       
  1032     TUint32 iUninitialisedDataSize;
       
  1033     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
  1034     TUint32 iSpare1;
       
  1035     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
  1036     TUint32 iSpare2;
       
  1037     /**
       
  1038       Length of the library's name
       
  1039       */
       
  1040     TUint16 iNameLength;
       
  1041     /**
       
  1042       First two bytes of the code segment's name, the name should be considered to
       
  1043       extend past the end of the TXipLibraryListEntry structure to a length
       
  1044       corresponding to iNameLength
       
  1045       */
       
  1046     TUint16 iName[1];
       
  1047     };
       
  1048 
       
  1049 /**
       
  1050 Returns the size of the TXipLibraryListEntry, including the file name length
       
  1051 
       
  1052 @return the size, in bytes, of the TXipLibraryListEntry and the library's
       
  1053 file name
       
  1054 */
       
  1055 inline TInt TXipLibraryListEntry::GetSize() const
       
  1056     {
       
  1057     return sizeof(TXipLibraryListEntry) - sizeof(iName) + (2 * iNameLength);
       
  1058     }
       
  1059 
       
  1060 /**
       
  1061 Structure used for extracting data from a descriptor returned by a call to
       
  1062 RSecuritySvrSession::GetList() when GetList() is called with TListId::EExecutables
       
  1063 as the first argument.
       
  1064 
       
  1065 @see RSecuritySvrSession::GetList()
       
  1066 
       
  1067 @code
       
  1068 //buffer is a TDesC8 containing 4-byte aligned TExecutablesListEntry objects
       
  1069 //create a pointer to the start of the data
       
  1070 TUint8* ptr = (TUint8*)buffer.Ptr();
       
  1071 //create a pointer to the end of the data
       
  1072 const TUint8* ptrEnd = ptr + buffer.Length();
       
  1073 while(ptr < ptrEnd)
       
  1074     {
       
  1075     //cast the pointer to be a TExecutablesListEntry object
       
  1076     TExecutablesListEntry& entry = *(TExecutablesListEntry*)ptr;
       
  1077     //use the TExecutablesListEntry pointer, i.e.
       
  1078     TUint16 nameLength = entry.iNameLength;
       
  1079     TPtr name(&(entry.iName[0]), nameLength, nameLength);
       
  1080     // move ptr on to point to the next TExecutablesListEntry object
       
  1081     ptr += Align4(entry.GetSize());
       
  1082     }
       
  1083 @endcode
       
  1084 */
       
  1085 class TExecutablesListEntry
       
  1086     {
       
  1087 public:
       
  1088     TInt GetSize() const;
       
  1089 public:
       
  1090     /**
       
  1091       Indicates whether an agent has registered to actively debug the executable,
       
  1092       a non-zero value indicates that an agent has attached.
       
  1093       */
       
  1094     TUint8 iIsActivelyDebugged;
       
  1095     /**
       
  1096       Indicates whether any agents have registered to passively debug the executable,
       
  1097       a non-zero value indicates that at least one agent is attached passively
       
  1098       */
       
  1099     TUint8 iIsPassivelyDebugged;
       
  1100     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
  1101     TUint32 iSpare1;
       
  1102     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
  1103     TUint32 iSpare2;
       
  1104     /**
       
  1105       Length of the executable's name
       
  1106       */
       
  1107     TUint16 iNameLength;
       
  1108     /**
       
  1109       First two bytes of the executable's name, the name should be considered to
       
  1110       extend past the end of the TExecutablesListEntry structure to a length
       
  1111       corresponding to iNameLength
       
  1112       */
       
  1113     TUint16 iName[1];
       
  1114     };
       
  1115 
       
  1116 /**
       
  1117 Returns the size of the TExecutablesListEntry, including the file name length
       
  1118 
       
  1119 @return the size, in bytes, of the TExecutablesListEntry and the executable's
       
  1120 file name
       
  1121 */
       
  1122 inline TInt TExecutablesListEntry::GetSize() const
       
  1123     {
       
  1124     return sizeof(TExecutablesListEntry) - sizeof(iName) + (2*iNameLength);
       
  1125     }
       
  1126 
       
  1127 /**
       
  1128 Structure used for extracting data from a descriptor returned by a call to
       
  1129 RSecuritySvrSession::GetList() when GetList() is called with TListId::EProcesses
       
  1130 as the first argument.
       
  1131 
       
  1132 @see RSecuritySvrSession::GetList()
       
  1133 
       
  1134 @code
       
  1135 //buffer is a TDesC8 containing 4-byte aligned TProcessListEntry objects
       
  1136 //create a pointer to the start of the data
       
  1137 TUint8* ptr = (TUint8*)buffer.Ptr();
       
  1138 //create a pointer to the end of the data
       
  1139 const TUint8* ptrEnd = ptr + buffer.Length();
       
  1140 while(ptr < ptrEnd)
       
  1141     {
       
  1142     //cast the pointer to be a TProcessListEntry object
       
  1143     TProcessListEntry& entry = *(TProcessListEntry*)ptr;
       
  1144     //use the TProcessListEntry pointer, i.e.
       
  1145     TUint16 fileNameLength = entry.iFileNameLength;
       
  1146     TPtr name(&(entry.iNames[0]), fileNameLength, fileNameLength);
       
  1147     // move ptr on to point to the next TProcessListEntry object
       
  1148     ptr += Align4(entry.GetSize());
       
  1149     }
       
  1150 @endcode
       
  1151 */
       
  1152 class TProcessListEntry
       
  1153     {
       
  1154     public:
       
  1155         TInt GetSize() const;
       
  1156 
       
  1157     public:
       
  1158         /** Process ID */
       
  1159         TUint64 iProcessId;
       
  1160 
       
  1161         /** The Uid3 of the process */
       
  1162         TUint32 iUid3;
       
  1163 
       
  1164         /** 
       
  1165          * Process Attributes
       
  1166          * @see DProcess::TProcessAttributes
       
  1167          */
       
  1168         TInt iAttributes;
       
  1169 
       
  1170         /**
       
  1171          * Length of fully qualified file name of the process in bytes. Note that this
       
  1172          * entry may be 0 if the process is in the process of shutting down.
       
  1173          */
       
  1174         TUint16 iFileNameLength;
       
  1175 
       
  1176         /**
       
  1177          * Length of current dynamic name of the process in bytes
       
  1178          */
       
  1179         TUint16 iDynamicNameLength;
       
  1180 
       
  1181         /**
       
  1182          * First two bytes of the process' file name, the name should be considered to
       
  1183          * extend past the end of the TProcessListEntry structure to a length
       
  1184          * corresponding to iFileNameLength. Directly after the data corresponding to the
       
  1185          * file name, the dynamic name is stored with a length of iDynamicNameLength characters.
       
  1186          * Note that these names are not null terminated and are concatenated directly after each other.
       
  1187          * 
       
  1188          * @code
       
  1189          * TProcessListEntry& entry; // entry is a reference to a TProcessListEntry
       
  1190          *
       
  1191          * //get the file name..
       
  1192          * TPtr fileName(&(entry.iNames[0]), iFileNameLength, iFileNameLength);
       
  1193          *
       
  1194          * //get the dynamic name length..
       
  1195          * TPtr dynamicName(&(entry.iNames[0]) + iFileNameLength, iDynamicNameLength, iDynamicNameLength);
       
  1196          * @endcode
       
  1197          */
       
  1198         TUint16 iNames[1];
       
  1199     };
       
  1200 
       
  1201 /**
       
  1202 Returns the size of the TProcessListEntry, including the file name length and the
       
  1203 dynamic name length
       
  1204 
       
  1205 @return the size, in bytes, of the TProcessListEntry and the executable's
       
  1206 file name file name and dynamic name
       
  1207 */
       
  1208 inline TInt TProcessListEntry::GetSize() const
       
  1209     {
       
  1210     return sizeof(TProcessListEntry) - sizeof(iNames) + (2 * (iFileNameLength + iDynamicNameLength));
       
  1211     }
       
  1212 
       
  1213 /**
       
  1214 Structure used for extracting data from a descriptor returned by a call to
       
  1215 RSecuritySvrSession::GetList() when GetList() is called with TListId::EThreads
       
  1216 as the first argument.
       
  1217 
       
  1218 @see RSecuritySvrSession::GetList()
       
  1219 
       
  1220 @code
       
  1221 //buffer is a TDesC8 containing 4-byte aligned TThreadListEntry objects
       
  1222 //create a pointer to the start of the data
       
  1223 TUint8* ptr = (TUint8*)buffer.Ptr();
       
  1224 //create a pointer to the end of the data
       
  1225 const TUint8* ptrEnd = ptr + buffer.Length();
       
  1226 while(ptr < ptrEnd)
       
  1227     {
       
  1228     //cast the pointer to be a TThreadListEntry object
       
  1229     TThreadListEntry& entry = *(TThreadListEntry*)ptr;
       
  1230     //use the TThreadListEntry pointer, i.e.
       
  1231     TUint16 nameLength = entry.iNameLength;
       
  1232     TPtr name(&(entry.iName[0]), nameLength, nameLength);
       
  1233     // move ptr on to point to the next TThreadListEntry object
       
  1234     ptr += Align4(entry.GetSize());
       
  1235     }
       
  1236 @endcode
       
  1237 */
       
  1238 class TThreadListEntry
       
  1239     {
       
  1240 public:
       
  1241     TInt GetSize() const;
       
  1242 public:
       
  1243     /**
       
  1244       Thread ID
       
  1245       */
       
  1246     TUint64 iThreadId;
       
  1247     /**
       
  1248       Process ID
       
  1249       */
       
  1250     TUint64 iProcessId;
       
  1251     /**
       
  1252       Address of the base of the supervisor stack
       
  1253       */
       
  1254     TUint32 iSupervisorStackBase;
       
  1255     /**
       
  1256       Size of the supervisor stack
       
  1257       */
       
  1258     TUint32 iSupervisorStackSize;
       
  1259     /**
       
  1260       Non-zero if iSupervisorStackBase has been set correctly
       
  1261       */
       
  1262     TUint8 iSupervisorStackBaseValid;
       
  1263     /**
       
  1264       Non-zero if iSupervisorStackSize has been set correctly
       
  1265       */
       
  1266     TUint8 iSupervisorStackSizeValid;
       
  1267     /**
       
  1268       Address of the thread's supervisor stack pointer
       
  1269       */
       
  1270     TUint32 iSupervisorStackPtr;
       
  1271     /**
       
  1272       Indicator of whether the value returned as iSupervisorStackPtr is valid.
       
  1273       It is necessary, but not necessarily sufficient, that the thread be suspended
       
  1274       for a valid value to be returned. This may be removed from the final API and
       
  1275       the value would be extracted instead via the ReadRegisters type calls.
       
  1276       */
       
  1277     TRegisterFlag iSupervisorStackPtrValid;
       
  1278     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
  1279     TUint32 iSpare1;
       
  1280     /** Currently unused element. May be used in future to aid maintaining compatibility. */
       
  1281     TUint32 iSpare2;
       
  1282     /**
       
  1283       The length of the thread's name
       
  1284       */
       
  1285     TUint16 iNameLength;
       
  1286     /**
       
  1287       First two bytes of the thread's name, the name should be considered to
       
  1288       extend past the end of the TThreadListEntry structure to a length
       
  1289       corresponding to iNameLength
       
  1290       */
       
  1291     TUint16 iName[1];
       
  1292     };
       
  1293 
       
  1294 /**
       
  1295 Returns the size of the TThreadListEntry, including the name length
       
  1296 
       
  1297 @return the size, in bytes, of the TExecutablesListEntry and the thread's name
       
  1298 */
       
  1299 inline TInt TThreadListEntry::GetSize() const
       
  1300     {
       
  1301     return sizeof(TThreadListEntry) - sizeof(iName) + (2 * iNameLength);
       
  1302     }
       
  1303 
       
  1304 /**
       
  1305 Denotes which list type to return from a RSecuritySvrSession::GetList() call
       
  1306 
       
  1307 @see RSecuritySvrSession::GetList()
       
  1308 */
       
  1309 enum TListId
       
  1310     {
       
  1311     /**
       
  1312     Indicates that the GetList() call should return a list of the processes in
       
  1313     the system. The returned buffer will contain an array of 4-byte aligned
       
  1314     TProcessListEntry objects.
       
  1315 
       
  1316     @see TProcessListEntry
       
  1317     */
       
  1318     EProcesses = 0,
       
  1319     /**
       
  1320     Indicates that the GetList() call should return a list of the threads in
       
  1321     the system. The returned buffer will contain an array of 4-byte aligned
       
  1322     TThreadListEntry objects.
       
  1323 
       
  1324     @see TThreadListEntry
       
  1325     */
       
  1326     EThreads = 1,
       
  1327     /**
       
  1328     Indicates that the GetList() call should return a list of the code segments in
       
  1329     the system. The returned buffer will contain an array of 4-byte aligned
       
  1330     TCodeSegListEntry objects.
       
  1331 
       
  1332     @see TCodeSegListEntry
       
  1333     */
       
  1334     ECodeSegs = 2,
       
  1335     /**
       
  1336     Indicates that the GetList() call should return a list of the XIP libraries in
       
  1337     the system. The returned buffer will contain an array of 4-byte aligned
       
  1338     EXipLibraries objects.
       
  1339 
       
  1340     @see EXipLibraries
       
  1341     */
       
  1342     EXipLibraries = 3,
       
  1343     /**
       
  1344     Indicates that the GetList() call should return a list of the executables in
       
  1345     the system. The returned buffer will contain an array of 4-byte aligned
       
  1346     EExecutables objects.
       
  1347 
       
  1348     @see EExecutables
       
  1349     */
       
  1350     EExecutables = 4,
       
  1351     /**
       
  1352     Indicates that the GetList() call should return a list of the logical devices in the system.
       
  1353     */
       
  1354     ELogicalDevices = 5,
       
  1355     /**
       
  1356     Indicates that the GetList() call should return a list of the mutexes in the system.
       
  1357     */
       
  1358     EMutexes = 6,
       
  1359     /**
       
  1360     Indicates that the GetList() call should return a list of the servers in the system.
       
  1361     */
       
  1362     EServers = 7,
       
  1363     /**
       
  1364     Indicates that the GetList() call should return a list of the sessions in the system.
       
  1365     */
       
  1366     ESessions = 8,
       
  1367     /**
       
  1368     Indicates that the GetList() call should return a list of the semaphores in the system.
       
  1369     */
       
  1370     ESemaphores = 9,
       
  1371     /**
       
  1372     Indicates that the GetList() call should return a list of the chunks in the system.
       
  1373     */
       
  1374     EChunks = 10,
       
  1375 
       
  1376     /**
       
  1377     Provides a complete list of all the breakpoints in the system and their
       
  1378     current state.
       
  1379 
       
  1380     @see EBreakpoints
       
  1381     */
       
  1382     EBreakpoints = 11,
       
  1383 
       
  1384     /** 
       
  1385     The following are for the possible use of kernel-side debug and SMP breakpoint
       
  1386     manipulation.
       
  1387     */
       
  1388     ESetBreak = 12,
       
  1389     ERemoveBreak = 13,
       
  1390     EModifyBreak = 14,
       
  1391     
       
  1392     /**
       
  1393      * Provides static information of the system
       
  1394      */
       
  1395     EStaticInfo = 15,
       
  1396 
       
  1397     /** Last listing enum. */
       
  1398     EListLast
       
  1399     };
       
  1400 
       
  1401 /**
       
  1402   Bit field values denoting the scope of a listing.
       
  1403 
       
  1404   In the debug functionality block, the TTag::iValue element which is returned for a listing tag
       
  1405   should be considered as a union of the supported values from this enumeration for that listing.
       
  1406   */
       
  1407 enum TListScope
       
  1408     {
       
  1409     EScopeNone = 0x0,             /**< Corresponds to no scope for a listing. equivalent to not supported */
       
  1410     EScopeGlobal= 0x1,            /**< Corresponds to a global scope for a listing. */
       
  1411     EScopeProcessSpecific = 0x2,  /**< Corresponds to a process specific scope for a listing. */
       
  1412     EScopeThreadSpecific = 0x4    /**< Corresponds to a thread specific scope for a listing. */
       
  1413     };
       
  1414 
       
  1415 /**
       
  1416 @internalComponent
       
  1417 
       
  1418 Interface constructor for passing IPC data for the GetList call.
       
  1419 */
       
  1420 class TListDetails
       
  1421     {
       
  1422 public:
       
  1423     TListDetails(const TListId aListId, const TListScope aListScope, TUint64 aTargetId=0)
       
  1424         : iListId(aListId),
       
  1425           iListScope(aListScope),
       
  1426           iTargetId(aTargetId) {}
       
  1427 public:
       
  1428     TListId iListId;
       
  1429     TListScope iListScope;
       
  1430     TUint64 iTargetId;
       
  1431     };
       
  1432 
       
  1433 
       
  1434     };
       
  1435 
       
  1436 
       
  1437 
       
  1438 
       
  1439 
       
  1440 
       
  1441 
       
  1442 
       
  1443 
       
  1444 
       
  1445 
       
  1446 
       
  1447 
       
  1448 
       
  1449 
       
  1450 
       
  1451 
       
  1452 
       
  1453 
       
  1454 
       
  1455 
       
  1456 
       
  1457 
       
  1458 
       
  1459 
       
  1460 
       
  1461 
       
  1462 
       
  1463 
       
  1464 
       
  1465 
       
  1466 
       
  1467 
       
  1468 
       
  1469 
       
  1470 
       
  1471 namespace Debug
       
  1472     {
       
  1473 
    31 	/**
  1474 	/**
    32 	 * The stop-mode debug interface is a stateless interface which may be called at any point
  1475 	 * The stop-mode debug interface is a stateless interface which may be called at any point
    33 	 * except user mode, provided the rest of the OS is not going to run or pre-empt it.
  1476 	 * except user mode, provided the rest of the OS is not going to run or pre-empt it.
    34 	 * For example, for stop-mode debugging, the ICE may run the stop_mode_api routine to
  1477 	 * For example, for stop-mode debugging, the ICE may run the stop_mode_api routine to
    35 	 * collect information about the system so long as no exceptions are enabled, and all 
  1478 	 * collect information about the system so long as no exceptions are enabled, and all 
   261 		
  1704 		
   262 				/** Utility functions */
  1705 				/** Utility functions */
   263 				static TInt CopyAndExpandDes(const TDesC& aSrc, TDes& aDest);
  1706 				static TInt CopyAndExpandDes(const TDesC& aSrc, TDes& aDest);
   264 				
  1707 				
   265 			};
  1708 			};
       
  1709 	
       
  1710 	
       
  1711 	/** 
       
  1712 	Provides static methods for accessing the information stored in a TRegisterInfo
       
  1713 	object.
       
  1714 	*/
       
  1715 	class Register
       
  1716 	    {
       
  1717 	public:
       
  1718 	    static TBool IsCoreReg(const Debug::TRegisterInfo aRegister);
       
  1719 	    static TBool IsCoproReg(const Debug::TRegisterInfo aRegister);
       
  1720 	    static TUint32 GetCoreRegId(const Debug::TRegisterInfo aRegister);
       
  1721 	    static TUint32 GetCRm(const Debug::TRegisterInfo aRegister);
       
  1722 	    static TUint32 GetCRn(const Debug::TRegisterInfo aRegister);
       
  1723 	    static TUint32 GetOpcode1(const Debug::TRegisterInfo aRegister);
       
  1724 	    static TUint32 GetOpcode2(const Debug::TRegisterInfo aRegister);
       
  1725 	    static TUint32 GetCoproNum(const Debug::TRegisterInfo aRegister);
       
  1726 	    };
       
  1727 
       
  1728 	/**
       
  1729 	Identify whether aRegister is a core register
       
  1730 	@param aRegister register ID to analyse
       
  1731 	@return ETrue if core register, EFalse otherwise
       
  1732 	*/
       
  1733 	inline TBool Register::IsCoreReg(const Debug::TRegisterInfo aRegister)
       
  1734 	    {
       
  1735 	    return ((aRegister & 0xff) == 0x0);
       
  1736 	    }
       
  1737 
       
  1738 	/**
       
  1739 	Identify whether aRegister is a coprocessor register
       
  1740 	@param aRegister register ID to analyse
       
  1741 	@return ETrue if coprocessor register, EFalse otherwise
       
  1742 	*/
       
  1743 	inline TBool Register::IsCoproReg(const Debug::TRegisterInfo aRegister)
       
  1744 	    {
       
  1745 	    return ((aRegister & 0xff) == 0x1);
       
  1746 	    }
       
  1747 
       
  1748 	/**
       
  1749 	Get the ID of the core register
       
  1750 	@param aRegister register ID to analyse
       
  1751 	@return ID of the core register
       
  1752 	*/
       
  1753 	inline TUint32 Register::GetCoreRegId(const Debug::TRegisterInfo aRegister)
       
  1754 	    {
       
  1755 	    return ((aRegister >> 8) & 0xff);
       
  1756 	    }
       
  1757 
       
  1758 	/**
       
  1759 	Get the CRm value of a coprocessor register
       
  1760 	@param aRegister register ID to analyse
       
  1761 	@return the CRm value of a coprocessor register
       
  1762 	*/
       
  1763 	inline TUint32 Register::GetCRm(const Debug::TRegisterInfo aRegister)
       
  1764 	    {
       
  1765 	    return ((aRegister >> 16) & 0xf);
       
  1766 	    }
       
  1767 
       
  1768 	/**
       
  1769 	Get the CRm value of a coprocessor register
       
  1770 	@param aRegister register ID to analyse
       
  1771 	@return the CRm value of a coprocessor register
       
  1772 	*/
       
  1773 	inline TUint32 Register::GetCRn(const Debug::TRegisterInfo aRegister)
       
  1774 	    {
       
  1775 	    return ((aRegister >> 20) & 0xf);
       
  1776 	    }
       
  1777 
       
  1778 	/**
       
  1779 	Get the Opcode1 value of a coprocessor register
       
  1780 	@param aRegister register ID to analyse
       
  1781 	@return the Opcode1 value of a coprocessor register
       
  1782 	*/
       
  1783 	inline TUint32 Register::GetOpcode1(const Debug::TRegisterInfo aRegister)
       
  1784 	    {
       
  1785 	    return ((aRegister >> 24) & 0x8);
       
  1786 	    }
       
  1787 	    
       
  1788 	/**
       
  1789 	Get the Opcode2 value of a coprocessor register
       
  1790 	@param aRegister register ID to analyse
       
  1791 	@return the Opcode2 value of a coprocessor register
       
  1792 	*/
       
  1793 	inline TUint32 Register::GetOpcode2(const Debug::TRegisterInfo aRegister)
       
  1794 	    {
       
  1795 	    return ((aRegister >> 27) & 0x8);
       
  1796 	    }
       
  1797 
       
  1798 	/**
       
  1799 	Get the coprocessor number of a coprocessor register
       
  1800 	@param aRegister register ID to analyse
       
  1801 	@return the coprocessor number of a coprocessor register
       
  1802 	*/
       
  1803 	inline TUint32 Register::GetCoproNum(const Debug::TRegisterInfo aRegister)
       
  1804 	    {
       
  1805 	    return ((aRegister >> 8) & 0xff);
       
  1806 	    }
       
  1807 
   266 
  1808 
   267 	};
  1809 	};
   268 #endif // D_STOP_MODE_API_H
  1810 #endif // D_STOP_MODE_API_H
   269 
  1811 
   270 // End of file sm_debug_api.h
  1812 // End of file sm_debug_api.h