os/kernelhwsrv/kernel/eka/include/rm_debug_api.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/rm_debug_api.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2558 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Definitions for the run mode debug agent client side sessions.
    1.18 +// 
    1.19 +// WARNING: This file contains some APIs which are internal and are subject
    1.20 +//          to change without notice. Such APIs should therefore not be used
    1.21 +//          outside the Kernel and Hardware Services package.
    1.22 +//
    1.23 +
    1.24 +#ifndef RM_DEBUG_API_H
    1.25 +#define RM_DEBUG_API_H
    1.26 +
    1.27 +/**
    1.28 +@file
    1.29 +@publishedPartner
    1.30 +@released
    1.31 +*/
    1.32 +
    1.33 +#include <e32cmn.h>
    1.34 +#include <e32def_private.h>
    1.35 +
    1.36 +/**
    1.37 +  The Debug namespace contains all API definitions used for on-target debugging.
    1.38 +  */
    1.39 +namespace Debug {
    1.40 +
    1.41 +/** This is the maximum size in bytes a user trace can be */
    1.42 +const TInt TUserTraceSize = 256;
    1.43 +
    1.44 +/**
    1.45 +  Information in the debug functionality block is represented as a concatenation
    1.46 +  of pairs of TTagHeader structures and arrays of TTag objects.
    1.47 +  @see TTagHeader
    1.48 +  @see RSecuritySvrSession::GetDebugFunctionality
    1.49 +  */
    1.50 +struct TTag
    1.51 +{
    1.52 +	/** Tag ID, value identifying this tag. */
    1.53 +	TUint32	iTagId;
    1.54 +	/**
    1.55 +	  Values correspond to TTagType enumerators.
    1.56 +	  @see TTagType
    1.57 +	  */
    1.58 +	TUint16	iType;
    1.59 +	/** Size of external data associated with this tag. */
    1.60 +	TUint16 iSize;
    1.61 +	/** Data associated with this tag. */
    1.62 +	TUint32 iValue;
    1.63 +};
    1.64 +
    1.65 +/**
    1.66 +  Enumeration defining the supported tag types. These enumerators are used in TTag.iTagId.
    1.67 +  @see TTag
    1.68 +  */
    1.69 +enum TTagType
    1.70 +{
    1.71 +	/** Indicates that the iValue field of a TTag structure will contain either ETrue or EFalse. */
    1.72 +	ETagTypeBoolean = 0,
    1.73 +	/** Indicates that the iValue field of a TTag structure will contain a value in the TUint32 range. */
    1.74 +	ETagTypeTUint32 = 1,
    1.75 +	/** Indicates that the iValue field of a TTag structure will contain values from an enumeration. */
    1.76 +	ETagTypeEnum = 2,
    1.77 +	/** Indicates that the iValue field of a TTag structure should be interpreted as a bit field. */
    1.78 +	ETagTypeBitField = 3,
    1.79 +	/** Indicates that the type of the iValue field of a TTag structure is unknown. */
    1.80 +	ETagTypeUnknown = 4,
    1.81 +	/** Indicates that the iValue field of a TTag structure will contain a pointer. */
    1.82 +	ETagTypePointer = 5
    1.83 +};
    1.84 +
    1.85 +/**
    1.86 +  Information in the debug functionality block is represented as a concatenation
    1.87 +  of pairs of TTagHeader structures and arrays of TTag objects.
    1.88 +  @see TTag
    1.89 +  @see RSecuritySvrSession::GetDebugFunctionality
    1.90 +  */
    1.91 +struct TTagHeader
    1.92 +{
    1.93 +	/** Value identifying the contents of this TTagHeader, should be interpreted as an enumerator from TTagHeaderId.
    1.94 +	  @see TTagHeaderId
    1.95 +	  */
    1.96 +	TUint16	iTagHdrId;
    1.97 +	/** The number of TTag elements in the array associated with this TTagHeader. */
    1.98 +	TUint16 iNumTags;
    1.99 +};
   1.100 +
   1.101 +/**
   1.102 +  Enumeration used to identify TTagHeader structures, TTagHeader::iTagHdrId elements take these enumerators as values.
   1.103 +  @see TTagHeader
   1.104 +  */
   1.105 +enum TTagHeaderId
   1.106 +{
   1.107 +	ETagHeaderIdCore = 0,            /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityCore. */
   1.108 +	ETagHeaderIdMemory = 1,          /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityMemory. */
   1.109 +	/**
   1.110 +	  Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityRegister.
   1.111 +	  These values are defined as in the document Symbian Core Dump File Format Appendix C
   1.112 +	  (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc).
   1.113 +	  The TTag objects in the associated array have an iSize value corresponding to the size of the register's data in bytes.
   1.114 +	  */
   1.115 +	ETagHeaderIdRegistersCore = 2,
   1.116 +	/**
   1.117 +	  Identifies a TTagHeader with associated TTag elements with iTagId values corresponding to coprocessor register identifiers.
   1.118 +	  Coprocessor registers are defined as in the document Symbian Core Dump File Format Appendix C as follows
   1.119 +	  (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc):
   1.120 +
   1.121 +	  For each 32-bit data word defining a co-pro register, the definition of the meaning of the bits follows
   1.122 +	  the ARM Architecture Reference manual instruction coding
   1.123 +
   1.124 +	  Upper Halfword	Lower Halfword
   1.125 +	  Opcode 2			CRm
   1.126 +
   1.127 +	  For example: The Domain Access Control Register is Register 3 of co-processor 15. The encoding is therefore
   1.128 +	  CRm = 3
   1.129 +	  Opcode2 = 0
   1.130 +
   1.131 +	  Therefore the functionality tag would be:
   1.132 +	  TagID:  15			// co-processor number
   1.133 +	  Type: ETagTypeTUint32
   1.134 +	  Data: 0x00000003		// Opcode2 = 0, CRm = 3
   1.135 +	  */
   1.136 +	ETagHeaderIdCoProRegisters = 3,  /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityRegister. */
   1.137 +	ETagHeaderIdBreakpoints = 4,     /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityBreakpoint. */
   1.138 +	ETagHeaderIdStepping = 5,        /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityStep. */
   1.139 +	ETagHeaderIdExecution = 6,       /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityExec. */
   1.140 +	ETagHeaderIdEvents = 7,          /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TEventType. */
   1.141 +	ETagHeaderIdApiConstants = 8,    /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityApiConstants.*/
   1.142 +	ETagHeaderList = 9,              /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TListId. */
   1.143 +	ETagHeaderIdKillObjects = 10,    /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityKillObject. */
   1.144 +	ETagHeaderIdSecurity = 11,		 /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalitySecurity */
   1.145 +	ETagHeaderIdBuffers = 12,        /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TBufferType. */
   1.146 +	ETagHeaderIdStopModeFunctions = 13, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityStopModeFunctions. */	
   1.147 +};
   1.148 +
   1.149 +/**
   1.150 +  This structure is not used in the run-mode debug API.
   1.151 +  @deprecated
   1.152 +  */
   1.153 +struct TSubBlock
   1.154 +{
   1.155 +	/** Header to identify the TSubBlock. */
   1.156 +	TTagHeader iHeader;
   1.157 +	/** Pointer to array of TTag values associated with this TSubBlock. */
   1.158 +	TTag* iTagArray;
   1.159 +};
   1.160 +
   1.161 +/**
   1.162 +  These tags define what kinds of core functionality are supported by the run-mode debug subsystem.
   1.163 +  TTag structures associated with the ETagHeaderIdCore sub-block will have iTagId values from this enumeration.
   1.164 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.165 +  */
   1.166 +enum TFunctionalityCore
   1.167 +{
   1.168 +	ECoreEvents = 0,        /**< Indicates whether events processing is supported. */
   1.169 +	ECoreStartStop = 1,     /**< Indicates whether suspending and resuming threads is supported. */
   1.170 +	ECoreMemory = 2,        /**< Indicates whether reading and writing memory is supported. */
   1.171 +	ECoreRegister = 3,      /**< Indicates whether reading and writing register values is supported. */
   1.172 +	ECoreBreakpoint = 4,    /**< Indicates whether breakpoints are supported. */
   1.173 +	ECoreStepping = 5,      /**< Indicates whether stepping is supported. */
   1.174 +	ECoreLists = 6,         /**< Indicates whether listings are supported. */
   1.175 +	ECoreLogging = 7,       /**< Indicates whether logging is supported. */
   1.176 +	ECoreHardware = 8,      /**< Indicates whether hardware support is supported. */
   1.177 +	ECoreApiConstants = 9,  /**< Indicates whether the information in the ETagHeaderIdApiConstants sub-block is relevant. */
   1.178 +	ECoreKillObjects = 10,  /**< Indicates whether killing objects (i.e. threads and processes) is supported. */
   1.179 +	ECoreSecurity = 11,		/**< Indicates whether OEM Debug token support or other security info is supported. */
   1.180 +	ECoreStopModeFunctions = 12, /**< Indicates whether Stop Mode function calling is supported. */
   1.181 +	ECoreStopModeBuffers = 13, /**< Indicates whether Stop Mode buffers are supported. */
   1.182 +	
   1.183 +	/**
   1.184 +	  @internalTechnology
   1.185 +	  A debug agent should find the number of core tags from the DFBlock rather than this enumerator.
   1.186 +	  */
   1.187 +	ECoreLast
   1.188 +};
   1.189 +
   1.190 +/**
   1.191 +  These tags define what kind of memory operations can be performed.
   1.192 +  TTag structures associated with the ETagHeaderIdMemory sub-block will have iTagId values from this enumeration.
   1.193 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.194 + */
   1.195 +enum TFunctionalityMemory
   1.196 +{
   1.197 +	EMemoryRead = 0,          /**< Indicates whether reading memory is supported. */
   1.198 +	EMemoryWrite = 1,         /**< Indicates whether writing memory is supported. */
   1.199 +	EMemoryAccess64 = 2,      /**< Indicates whether 64 bit memory access is supported. */
   1.200 +	EMemoryAccess32 = 3,      /**< Indicates whether 32 bit memory access is supported. */
   1.201 +	EMemoryAccess16 = 4,      /**< Indicates whether 16 bit memory access is supported. */
   1.202 +	EMemoryAccess8 = 5,       /**< Indicates whether 8 bit memory access is supported. */
   1.203 +	EMemoryBE8 = 6,           /**< Indicates whether reading memory as 8 bit big-endian values is supported. */
   1.204 +	EMemoryBE32 = 7,          /**< Indicates whether reading memory as 32 bit big-endian values is supported. */
   1.205 +	EMemoryLE8 = 8,           /**< Indicates whether reading memory as 8 bit little-endian values is supported. */
   1.206 +	EMemoryMaxBlockSize = 9,  /**< Corresponds to the maximum size of a block of memory which can be requested. */
   1.207 +	/**
   1.208 +	  @internalTechnology
   1.209 +	  A debug agent should find the number of memory tags from the DFBlock rather than this enumerator.
   1.210 +	  */
   1.211 +	EMemoryLast
   1.212 +};
   1.213 +
   1.214 +/**
   1.215 +  These tags define which objects can be killed by the device driver.
   1.216 +  TTag structures associated with the ETagHeaderIdKillObjects sub-block will have iTagId values from this enumeration.
   1.217 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.218 + */
   1.219 +enum TFunctionalityKillObject
   1.220 +{
   1.221 +	EFunctionalityKillThread = 0,          /**< Indicates whether killing threads is supported. */
   1.222 +	EFunctionalityKillProcess = 1,         /**< Indicates whether killing processes is supported. */
   1.223 +	/**
   1.224 +	  @internalTechnology
   1.225 +	  A debug agent should find the number of kill object tags from the DFBlock rather than this enumerator.
   1.226 +	  */
   1.227 +	EFunctionalityKillObjectLast
   1.228 +};
   1.229 +
   1.230 +/**
   1.231 +  A TTag with an id from the TFunctionalityRegister enum will have a value from this enumeration.
   1.232 +  The values define how a register can be accessed, if at all.
   1.233 + */
   1.234 +enum TFunctionalityAccess
   1.235 +{
   1.236 +	EAccessNone = 0,       /**< Indicates that a register cannot be accessed. */
   1.237 +	EAccessReadOnly = 1,   /**< Indicates that a register can be read, but not written to. */
   1.238 +	EAccessWriteOnly = 2,  /**< Indicates that a register can be written to, but not read. */
   1.239 +	EAccessReadWrite = 3,  /**< Indicates that a register can be both read and written to. */
   1.240 +	EAccessUnknown = 4,    /**< Indicates that it is unspecified whether reading or writing to a register is possible. */
   1.241 +};
   1.242 +
   1.243 +/**
   1.244 +  These enumerators act as core register identifiers.
   1.245 +  TTag structures associated with the ETagHeaderIdRegistersCore sub-block will have iTagId values from this enumeration.
   1.246 +  The numeric value of each enumerator identifies the register according to the definitions in the Symbian Core Dump File Format Appendix B
   1.247 +  (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc).
   1.248 +  */
   1.249 +enum TFunctionalityRegister
   1.250 +{
   1.251 +	ERegisterR0 = 0x00000000,      /**< Identifier for user mode register R0. */
   1.252 +	ERegisterR1 = 0x00000100,      /**< Identifier for user mode register R1. */
   1.253 +	ERegisterR2 = 0x00000200,      /**< Identifier for user mode register R2. */
   1.254 +	ERegisterR3 = 0x00000300,      /**< Identifier for user mode register R3. */
   1.255 +	ERegisterR4 = 0x00000400,      /**< Identifier for user mode register R4. */
   1.256 +	ERegisterR5 = 0x00000500,      /**< Identifier for user mode register R5. */
   1.257 +	ERegisterR6 = 0x00000600,      /**< Identifier for user mode register R6. */
   1.258 +	ERegisterR7 = 0x00000700,      /**< Identifier for user mode register R7. */
   1.259 +	ERegisterR8 = 0x00000800,      /**< Identifier for user mode register R8. */
   1.260 +	ERegisterR9 = 0x00000900,      /**< Identifier for user mode register R9. */
   1.261 +	ERegisterR10 = 0x00000a00,     /**< Identifier for user mode register R10. */
   1.262 +	ERegisterR11 = 0x00000b00,     /**< Identifier for user mode register R11. */
   1.263 +	ERegisterR12 = 0x00000c00,     /**< Identifier for user mode register R12. */
   1.264 +	ERegisterR13 = 0x00000d00,     /**< Identifier for user mode register R13. */
   1.265 +	ERegisterR14 = 0x00000e00,     /**< Identifier for user mode register R14. */
   1.266 +	ERegisterR15 = 0x00000f00,     /**< Identifier for user mode register R15. */
   1.267 +	ERegisterCpsr = 0x00001000,    /**< Identifier for CPSR. */
   1.268 +	ERegisterR13Svc = 0x00001100,  /**< Identifier for R13 supervisor mode banked register. */
   1.269 +	ERegisterR14Svc = 0x00001200,  /**< Identifier for R14 supervisor mode banked register. */
   1.270 +	ERegisterSpsrSvc = 0x00001300, /**< Identifier for SPSR supervisor mode banked register. */
   1.271 +	ERegisterR13Abt = 0x00001400,  /**< Identifier for R13 Abort mode banked register. */
   1.272 +	ERegisterR14Abt = 0x00001500,  /**< Identifier for R14 Abort mode banked register. */
   1.273 +	ERegisterSpsrAbt = 0x00001600, /**< Identifier for SPSR Abort mode banked register. */
   1.274 +	ERegisterR13Und = 0x00001700,  /**< Identifier for R13 Undefined mode banked register. */
   1.275 +	ERegisterR14Und = 0x00001800,  /**< Identifier for R14 Undefined mode banked register. */
   1.276 +	ERegisterSpsrUnd = 0x00001900, /**< Identifier for SPSR Undefined mode banked register. */
   1.277 +	ERegisterR13Irq = 0x00001a00,  /**< Identifier for R13 Interrupt mode banked register. */
   1.278 +	ERegisterR14Irq = 0x00001b00,  /**< Identifier for R14 Interrupt mode banked register. */
   1.279 +	ERegisterSpsrIrq = 0x00001c00, /**< Identifier for SPSR Interrupt mode banked register. */
   1.280 +	ERegisterR8Fiq = 0x00001d00,   /**< Identifier for R8 Fast Interrupt mode banked register. */
   1.281 +	ERegisterR9Fiq = 0x00001e00,   /**< Identifier for R9 Fast Interrupt mode banked register. */
   1.282 +	ERegisterR10Fiq = 0x00001f00,  /**< Identifier for R10 Fast Interrupt mode banked register. */
   1.283 +	ERegisterR11Fiq = 0x00002000,  /**< Identifier for R11 Fast Interrupt mode banked register. */
   1.284 +	ERegisterR12Fiq = 0x00002100,  /**< Identifier for R12 Fast Interrupt mode banked register. */
   1.285 +	ERegisterR13Fiq = 0x00002200,  /**< Identifier for R13 Fast Interrupt mode banked register. */
   1.286 +	ERegisterR14Fiq = 0x00002300,  /**< Identifier for R14 Fast Interrupt mode banked register. */
   1.287 +	ERegisterSpsrFiq = 0x00002400, /**< Identifier for SPSR Fast Interrupt mode banked register. */
   1.288 +	/**
   1.289 +	  @internalTechnology
   1.290 +	  A debug agent should find the number of core registers from the DFBlock rather than this enumerator.
   1.291 +	  */
   1.292 +	ERegisterLast = 37
   1.293 +};
   1.294 +
   1.295 +
   1.296 +/**
   1.297 +  These tags define the kind of breakpoints that are supported.
   1.298 +  TTag structures associated with the ETagHeaderIdBreakpoints sub-block will have iTagId values from this enumeration.
   1.299 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.300 + */
   1.301 +enum TFunctionalityBreakpoint
   1.302 +{
   1.303 +	EBreakpointThread = 0,         /**< Indicates whether thread specific breakpoints are supported. */
   1.304 +	EBreakpointProcess = 1,        /**< Indicates whether process specific breakpoints are supported. */
   1.305 +	EBreakpointSystem = 2,         /**< Indicates whether system wide breakpoints are supported. */
   1.306 +	EBreakpointArm = 3,            /**< Indicates whether ARM mode breakpoints are supported. */
   1.307 +	EBreakpointThumb = 4,          /**< Indicates whether Thumb mode breakpoints are supported. */
   1.308 +	EBreakpointT2EE = 5,           /**< Indicates whether Thumb2 mode breakpoints are supported. */
   1.309 +	EBreakpointArmInst = 6,        /**< Reserved for future use. */
   1.310 +	EBreakpointThumbInst = 7,      /**< Reserved for future use. */
   1.311 +	EBreakpointT2EEInst = 8,       /**< Reserved for future use. */
   1.312 +	EBreakpointSetArmInst = 9,     /**< Reserved for future use. */
   1.313 +	EBreakpointSetThumbInst = 10,  /**< Reserved for future use. */
   1.314 +	EBreakpointSetT2EEInst = 11,   /**< Reserved for future use. */
   1.315 +	/**
   1.316 +	  @internalTechnology
   1.317 +	  A debug agent should find the number of breakpoint tags from the DFBlock rather than this enumerator.
   1.318 +	  */
   1.319 +	EBreakpointLast
   1.320 +};
   1.321 +
   1.322 +/**
   1.323 +  These enumerators provide information about the stepping capabilities of the debug sub-system.
   1.324 +  TTag structures associated with the ETagHeaderIdStepping sub-block will have iTagId values from this enumeration.
   1.325 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.326 + */
   1.327 +enum TFunctionalityStep
   1.328 +{
   1.329 +	EStep = 0, /**< Indicates whether instruction stepping is supported. */
   1.330 +	/**
   1.331 +	  @internalTechnology
   1.332 +	  A debug agent should find the number of stepping tags from the DFBlock rather than this enumerator.
   1.333 +	  */
   1.334 +	EStepLast
   1.335 +};
   1.336 +
   1.337 +/**
   1.338 +  These enumerators provide information about the execution control capabilities of the debug sub-system.
   1.339 +  TTag structures associated with the ETagHeaderIdExecution sub-block will have iTagId values from this enumeration.
   1.340 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.341 + */
   1.342 +enum TFunctionalityExec
   1.343 +{
   1.344 +	EExecThreadSuspendResume = 0,  /**< Indicates whether suspending and resuming threads is supported. */
   1.345 +	EExecProcessSuspendResume = 1, /**< Indicates whether suspending and resuming processes is supported. */
   1.346 +	EExecSystemSuspendResume = 2,  /**< Indicates whether suspending and resuming the entire system is supported. */
   1.347 +	/**
   1.348 +	  @internalTechnology
   1.349 +	  A debug agent should find the number of execution control tags from the DFBlock rather than this enumerator.
   1.350 +	  */
   1.351 +	EExecLast
   1.352 +};
   1.353 +
   1.354 +/**
   1.355 +  This enumeration defines the event types supported by the debug sub-system.
   1.356 +  TTag structures associated with the ETagHeaderIdEvents sub-block will have
   1.357 +  iTagId values from this enumeration, and iValue values from the TKernelEventAction enumeration.
   1.358 +
   1.359 +  These enumerators are also used by the RSecuritySvrSession API to identify events.
   1.360 +  @see RSecuritySvrSession
   1.361 +  @see TKernelEventAction
   1.362 + */
   1.363 +enum TEventType
   1.364 +{
   1.365 +	EEventsBreakPoint = 0,    /**< Identifies a breakpoint event. */
   1.366 +	EEventsSwExc = 1,         /**< Identifies a software exception event. */
   1.367 +	EEventsHwExc = 2,         /**< Identifies a hardware exception event. */
   1.368 +	EEventsKillThread = 3,    /**< Identifies a kill thread event. */
   1.369 +	EEventsAddLibrary = 4,    /**< Identifies an add library event. */
   1.370 +	EEventsRemoveLibrary = 5, /**< Identifies a remove library event. */
   1.371 +	/**
   1.372 +	 If an event is generated and there is only a single space remaining in the events queue then
   1.373 +	 an event of type EEventsBufferFull will be stored in the queue and the generated event will
   1.374 +	 be discarded. If further events occur while the buffer is full the events will be discarded.
   1.375 +	 As such an event of type EEventsBufferFull being returned signifies that one or more events
   1.376 +	 were discarded. An event of this type has no valid data associated with it.
   1.377 +	 */
   1.378 +	EEventsBufferFull = 6,
   1.379 +	EEventsUnknown = 7,       /**< Identifies an event of unknown type. */
   1.380 +	EEventsUserTrace = 8,     /**< Identifies a user trace. */
   1.381 +	EEventsProcessBreakPoint = 9, /**< Identifies a process breakpoint event. */
   1.382 +	EEventsStartThread = 10, /**< Identifies a start thread event. */
   1.383 +	EEventsUserTracesLost = 11, /**< Identifies user traces being lost. */
   1.384 +	EEventsAddProcess = 12, /**< Identifies an AddProcess event */
   1.385 +	EEventsRemoveProcess = 13, /**< Identifies a RemoveProcess event */
   1.386 +	/**
   1.387 +	  @internalTechnology
   1.388 +	  A debug agent should find the number of event types from the DFBlock rather than this enumerator.
   1.389 +	  */
   1.390 +	EEventsLast
   1.391 +};
   1.392 +
   1.393 +/**
   1.394 +  These enumerators provide information about constants which are used in the RSecuritySvrSession API.
   1.395 +  TTag structures associated with the ETagHeaderIdApiConstants sub-block will have iTagId values from this enumeration.
   1.396 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.397 + */
   1.398 +enum TFunctionalityApiConstants
   1.399 +	{
   1.400 +	/**
   1.401 +	  Corresponds to the size of a buffer required to store a TEventInfo.
   1.402 +	  @see TEventInfo
   1.403 +	  */
   1.404 +	EApiConstantsTEventInfoSize = 0,
   1.405 +	/**
   1.406 +	  @internalTechnology
   1.407 +	  A debug agent should find the number of API constants tags from the DFBlock rather than this enumerator.
   1.408 +	  */
   1.409 +	EApiConstantsLast,
   1.410 +	};
   1.411 +
   1.412 +/**
   1.413 +  The set of possible actions which could be taken when a kernel event occurs.
   1.414 +  Not all actions are possible for all events. The debug functionality sub-block with header id ETagHeaderIdEvents
   1.415 +  indicates which values are permitted for each event. The value given for that event should be
   1.416 +  considered as the most intrusive action the debugger may set: with the definition that EActionSuspend is more
   1.417 +  intrusive than EActionContinue, which is more intrusive than EActionIgnore.
   1.418 +  @see RSecuritySvrSession
   1.419 +  */
   1.420 +enum TKernelEventAction
   1.421 +{
   1.422 +	/** If an event action is set to this value then events of that type will be
   1.423 +	  ignored, and not reported to the debugger. */
   1.424 +	EActionIgnore = 0,
   1.425 +	/** If an event action is set to this value then events of that type will be
   1.426 +	  reported to the debugger and the thread which generated the event will be
   1.427 +	  allowed to continue executing. */
   1.428 +	EActionContinue = 1,
   1.429 +	/** If an event action is set to this value then events of that type will be
   1.430 +	  reported to the debugger and the thread which generated the event will be
   1.431 +	  suspended. */
   1.432 +	EActionSuspend = 2,
   1.433 +	/**
   1.434 +	  @internalTechnology
   1.435 +	  Count of event actions.
   1.436 +	  */
   1.437 +	EActionLast
   1.438 +};
   1.439 +
   1.440 +/**
   1.441 +  These enumerators provide information about the ability of the debug subsystem to support OEM Debug tokens.
   1.442 +  TTag structures associated with the ETagHeaderIdSecurity sub-block will have iTagId values from this enumeration.
   1.443 +  See each enumerator for an explanation of how a TTag with that iTagId should be interpreted.
   1.444 + */
   1.445 +enum TFunctionalitySecurity
   1.446 +{
   1.447 +	ESecurityOEMDebugToken = 0,  /**< Indicates whether the DSS supports the use of OEM Debug Tokens. */
   1.448 +
   1.449 +	/**
   1.450 +	  @internalTechnology
   1.451 +	  A debug agent should find the number of tags from the DFBlock rather than this enumerator.
   1.452 +	  */
   1.453 +	ESecurityLast
   1.454 +};
   1.455 +
   1.456 +/**
   1.457 +  Used for storing the contents of a 32 bit register
   1.458 +  */
   1.459 +typedef TUint32 TRegisterValue32;
   1.460 +
   1.461 +
   1.462 +/**
   1.463 + * Processor mode
   1.464 + */
   1.465 +enum TArmProcessorModes
   1.466 +{
   1.467 +	EUserMode=0x10,    	//!< EUserMode
   1.468 +    EFiqMode=0x11,  	//!< EFiqMode
   1.469 +    EIrqMode=0x12,  	//!< EIrqMode
   1.470 +    ESvcMode=0x13,  	//!< ESvcMode
   1.471 +    EAbortMode=0x17,	//!< EAbortMode
   1.472 +    EUndefMode=0x1b,	//!< EUndefMode
   1.473 +    EMaskMode=0x1f  	//!< EMaskMode
   1.474 +};
   1.475 +
   1.476 +
   1.477 +
   1.478 +/**
   1.479 +  Structure containing information about the state of the registers when a
   1.480 +  hardware exception occurred
   1.481 +  */
   1.482 +class TRmdArmExcInfo
   1.483 +	{
   1.484 +public:
   1.485 +	/** Enumeration detailing the types of exception which may occur. */
   1.486 +	enum TExceptionType
   1.487 +		{
   1.488 +		/** Enumerator signifying that a prefetch abort error has occurred. */
   1.489 +		EPrefetchAbort = 0,
   1.490 +		/** Enumerator signifying that a data abort error has occurred. */
   1.491 +		EDataAbort = 1,
   1.492 +		/** Enumerator signifying that an undefined instruction error has occurred. */
   1.493 +		EUndef =2
   1.494 +		};
   1.495 +
   1.496 +	/** Value of CPSR. */
   1.497 +	TRegisterValue32 iCpsr;
   1.498 +	/** Type of exception which has occurred. */
   1.499 +	TExceptionType iExcCode;
   1.500 +	/** Value of R13 supervisor mode banked register. */
   1.501 +	TRegisterValue32 iR13Svc;
   1.502 +	/** Value of user mode register R4. */
   1.503 +	TRegisterValue32 iR4;
   1.504 +	/** Value of user mode register R5. */
   1.505 +	TRegisterValue32 iR5;
   1.506 +	/** Value of user mode register R6. */
   1.507 +	TRegisterValue32 iR6;
   1.508 +	/** Value of user mode register R7. */
   1.509 +	TRegisterValue32 iR7;
   1.510 +	/** Value of user mode register R8. */
   1.511 +	TRegisterValue32 iR8;
   1.512 +	/** Value of user mode register R9. */
   1.513 +	TRegisterValue32 iR9;
   1.514 +	/** Value of user mode register R10. */
   1.515 +	TRegisterValue32 iR10;
   1.516 +	/** Value of user mode register R11. */
   1.517 +	TRegisterValue32 iR11;
   1.518 +	/** Value of R14 supervisor mode banked register. */
   1.519 +	TRegisterValue32 iR14Svc;
   1.520 +	/** Address which caused exception (System Control Coprocessor Fault Address Register) */
   1.521 +	TRegisterValue32 iFaultAddress;
   1.522 +	/** Value of System Control Coprocessor Fault Status Register. */
   1.523 +	TRegisterValue32 iFaultStatus;
   1.524 +	/** Value of SPSR supervisor mode banked register. */
   1.525 +	TRegisterValue32 iSpsrSvc;
   1.526 +	/** Value of user mode register R13. */
   1.527 +	TRegisterValue32 iR13;
   1.528 +	/** Value of user mode register R14. */
   1.529 +	TRegisterValue32 iR14;
   1.530 +	/** Value of user mode register R0. */
   1.531 +	TRegisterValue32 iR0;
   1.532 +	/** Value of user mode register R1. */
   1.533 +	TRegisterValue32 iR1;
   1.534 +	/** Value of user mode register R2. */
   1.535 +	TRegisterValue32 iR2;
   1.536 +	/** Value of user mode register R3. */
   1.537 +	TRegisterValue32 iR3;
   1.538 +	/** Value of user mode register R12. */
   1.539 +	TRegisterValue32 iR12;
   1.540 +	/** Value of user mode register R15, points to instruction which caused exception. */
   1.541 +	TRegisterValue32 iR15;
   1.542 +	};
   1.543 +
   1.544 +/**
   1.545 +  The maximum size, in bytes, of the panic category string returned as part of a
   1.546 +  TEventInfo object.
   1.547 +
   1.548 +  @see TEventInfo
   1.549 +  @see TThreadKillInfo
   1.550 +  */
   1.551 +const TInt KPanicCategoryMaxName = KMaxName;
   1.552 +
   1.553 +/**
   1.554 +  Event specific information returned as part of a TEventInfo object when
   1.555 +  an agent set breakpoint is hit.
   1.556 +  */
   1.557 +class TThreadBreakPointInfo
   1.558 +	{
   1.559 +public:
   1.560 +	/** Identifies the type of exception. */
   1.561 +	TExcType iExceptionNumber;
   1.562 +	/** Structure containing information about the ARM register values. */
   1.563 +	TRmdArmExcInfo iRmdArmExcInfo;
   1.564 +	};
   1.565 +
   1.566 +/**
   1.567 +  Event specific information returned as part of a TEventInfo object when
   1.568 +  a software exception occurs.
   1.569 +  */
   1.570 +class TThreadSwExceptionInfo
   1.571 +	{
   1.572 +public:
   1.573 +	/** The value of the program counter. */
   1.574 +	TUint32 iCurrentPC;
   1.575 +	/** Identifies the type of exception. */
   1.576 +	TExcType iExceptionNumber;
   1.577 +	};
   1.578 +
   1.579 +/**
   1.580 +  Event specific information returned as part of a TEventInfo object when
   1.581 +  a hardware exception occurs.
   1.582 +  */
   1.583 +class TThreadHwExceptionInfo
   1.584 +	{
   1.585 +public:
   1.586 +	/** Identifies the type of exception. */
   1.587 +	TExcType iExceptionNumber;
   1.588 +	/** Structure containing information about the ARM register values. */
   1.589 +	TRmdArmExcInfo iRmdArmExcInfo;
   1.590 +	};
   1.591 +
   1.592 +/**
   1.593 +  Event specific information returned as part of a TEventInfo object when
   1.594 +  a thread kill event occurs.
   1.595 +  */
   1.596 +class TThreadKillInfo
   1.597 +	{
   1.598 +public:
   1.599 +	/** The value of the program counter. */
   1.600 +	TUint32 iCurrentPC;
   1.601 +	/** 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. */
   1.602 +	TInt iExitReason;
   1.603 +	/** Specifies the type of the thread kill event, values correspond to elements of TExitType. */
   1.604 +	TUint8 iExitType;
   1.605 +	/** The panic category of the killed thread. */
   1.606 +	TUint8 iPanicCategory[KPanicCategoryMaxName];
   1.607 +	/** Contains the length in bytes of the initialised data in iPanicCategory. */
   1.608 +	TInt iPanicCategoryLength;
   1.609 +	};
   1.610 +
   1.611 +/**
   1.612 +  Event specific information returned as part of a TEventInfo object when
   1.613 +  a library load event occurs.
   1.614 +  */
   1.615 +class TLibraryLoadedInfo
   1.616 +	{
   1.617 +public:
   1.618 +	/** The name of the file that the library was loaded from. */
   1.619 +	TUint8 iFileName[KMaxName];
   1.620 +	/** Contains the length in bytes of the initialised data in iFileName. */
   1.621 +	TInt iFileNameLength;
   1.622 +	/** The code base address (.text). */
   1.623 +	TUint32 iCodeAddress;
   1.624 +	/** The base address of the initialised data section (.data). */
   1.625 +	TUint32 iDataAddress;
   1.626 +	};
   1.627 +
   1.628 +/**
   1.629 +  Event specific information returned as part of a TEventInfo object when
   1.630 +  a thread is started
   1.631 +  */
   1.632 +class TStartThreadInfo
   1.633 +	{
   1.634 +public:
   1.635 +	/** The name of the file that the process owning the thread was created from. */
   1.636 +	TUint8 iFileName[KMaxName];
   1.637 +	/** Contains the length in bytes of the initialised data in iFileName. */
   1.638 +	TInt iFileNameLength;
   1.639 +	};
   1.640 +
   1.641 +/**
   1.642 +  Event specific information returned as part of a TEventInfo object when
   1.643 +  a process is added. Note that the Process may not be fully constructed,
   1.644 +  e.g. no threads.
   1.645 +  */
   1.646 +class TAddProcessInfo
   1.647 +	{
   1.648 +public:
   1.649 +	/** The name of the file that the process was created from. */
   1.650 +	TUint8 iFileName[KMaxName];
   1.651 +	/** Contains the length in bytes of the initialised data in iFileName. */
   1.652 +	TInt iFileNameLength;
   1.653 +	/** The UID3 of this process */
   1.654 +	TUint32 iUid3;  
   1.655 +	/** Contains the CreatorThread ID if available: May be 0 */
   1.656 +	TUint64 iCreatorThreadId;  
   1.657 +	};
   1.658 +
   1.659 +/**
   1.660 +  Event specific information returned as part of a TEventInfo object when
   1.661 +  a process is removed. Note that the Process may not be fully destroyed,
   1.662 +  so its resources should only be accessed if you already have a handle to it.
   1.663 +  */
   1.664 +class TRemoveProcessInfo
   1.665 +	{
   1.666 +public:
   1.667 +	/** The name of the file that the process was created from. */
   1.668 +	TUint8 iFileName[KMaxName];
   1.669 +	/** Contains the length in bytes of the initialised data in iFileName. */
   1.670 +	TInt iFileNameLength;
   1.671 +	TUint32 iSpare1;	// Unused
   1.672 +	};
   1.673 +
   1.674 +/**
   1.675 +  Event specific information returned as part of a TEventInfo object when
   1.676 +  a library unload event occurs.
   1.677 +  */
   1.678 +class TLibraryUnloadedInfo
   1.679 +	{
   1.680 +public:
   1.681 +	/** The name of the file that the library was loaded from. */
   1.682 +	TUint8 iFileName[KMaxName];
   1.683 +	/** Contains the length in bytes of the initialised data in iFileName. */
   1.684 +	TInt iFileNameLength;
   1.685 +	};
   1.686 +
   1.687 +/**
   1.688 + * Enum to represent the context of a user trace message
   1.689 + */ 
   1.690 +enum TUserTraceMessageContext 
   1.691 +{
   1.692 +	ESingleMessage = 0x1,   /** Indicates this message is the only one corresponding to a given user trace */ 
   1.693 +	EMultiStart = 0x2, /** Indicates this message is the start of a user trace which consists of multiple messages */
   1.694 +	EMultiMid = 0x3, /** Indicates this message is one in a series of user trace messages */
   1.695 +	EMultiEnd = 0x4, /** Indicates this message is the last in a series of user trace messages */
   1.696 +	/**
   1.697 +	  @internalTechnology
   1.698 +	  A debug agent should find the number of core tags from the DFBlock rather than this enumerator.
   1.699 +	  */
   1.700 +	ELast = 0x5	
   1.701 +};
   1.702 +	
   1.703 +/**
   1.704 + *   Event specific information returned as part of a TEventInfo object 
   1.705 + *   when a user trace event occurs.
   1.706 + */
   1.707 +class TUserTraceInfo
   1.708 +	{
   1.709 +public:
   1.710 +	/** The user trace text */
   1.711 +	TUint8 iUserTraceText[TUserTraceSize];
   1.712 +	
   1.713 +	/** User trace text length */
   1.714 +	TInt iUserTraceLength;
   1.715 +	
   1.716 +	/** The context of the message */
   1.717 +	TUserTraceMessageContext iMessageStatus;
   1.718 +	};
   1.719 +	
   1.720 +	
   1.721 +/**
   1.722 +  Structure used to store information about an event. An object of this type
   1.723 +  is passed as an argument to the RSecuritySvrSession::GetEvent function,
   1.724 +  and is filled in by the debug driver, and returned to the agent, when a
   1.725 +  relevant event occurs.
   1.726 +
   1.727 +  The debug functionality block contains the size in bytes of the data that
   1.728 +  the driver will return when a GetEvent call is issued. A debug agent should
   1.729 +  ensure that this value equals the size of this TEventInfo object to ensure
   1.730 +  that a compatible debug driver is being used. The value is stored as
   1.731 +  EApiConstantsTEventInfoSize in the TFunctionalityApiConstants block.
   1.732 +
   1.733 +  @see RSecuritySvrSession::GetDebugFunctionality
   1.734 +  @see RSecuritySvrSession::GetEvent
   1.735 +  */
   1.736 +class TEventInfo
   1.737 +	{
   1.738 +public:
   1.739 +
   1.740 +	/** Constructor sets all elements to default values. */
   1.741 +	inline TEventInfo() { Reset(); };
   1.742 +
   1.743 +	/** Resets all values to default values. */
   1.744 +	inline void Reset()
   1.745 +		{
   1.746 +		iProcessId = 0;
   1.747 +		iProcessIdValid = EFalse;
   1.748 +		iThreadId = 0;
   1.749 +		iThreadIdValid = EFalse;
   1.750 +		iEventType = (TEventType)NULL;
   1.751 +		};
   1.752 +
   1.753 +public:
   1.754 +
   1.755 +	/** The process ID of the process which the event occurred in. */
   1.756 +	TUint64 				iProcessId;
   1.757 +	/** The thread ID of the thread which the event occurred in. */
   1.758 +	TUint64 				iThreadId;
   1.759 +	/** Has value ETrue if iProcessId is valid, EFalse otherwise. */
   1.760 +	TUint8					iProcessIdValid;
   1.761 +	/** Has value ETrue if iThreadId is valid, EFalse otherwise. */
   1.762 +	TUint8					iThreadIdValid;
   1.763 +	/** Indicates the type of the event. This type should be used to determine
   1.764 +	    the type of the information stored in the union which is part of this class. */
   1.765 +	TEventType				iEventType;
   1.766 +	union
   1.767 +		{
   1.768 +		/** Information which is specific to the break point event. */
   1.769 +		TThreadBreakPointInfo iThreadBreakPointInfo;
   1.770 +		/** Information which is specific to the software exception event. */
   1.771 +		TThreadSwExceptionInfo iThreadSwExceptionInfo;
   1.772 +		/** Information which is specific to the hardware exception event. */
   1.773 +		TThreadHwExceptionInfo iThreadHwExceptionInfo;
   1.774 +		/** Information which is specific to the thread kill event. */
   1.775 +		TThreadKillInfo iThreadKillInfo;
   1.776 +		/** Information which is specific to the library loaded event. */
   1.777 +		TLibraryLoadedInfo iLibraryLoadedInfo;
   1.778 +		/** Information which is specific to the library unloaded event. */
   1.779 +		TLibraryUnloadedInfo iLibraryUnloadedInfo;
   1.780 +		/** Information which is specific to the user trace event. */
   1.781 +		TUserTraceInfo iUserTraceInfo;
   1.782 +		/** Information which is specific to the start thread event. */
   1.783 +		TStartThreadInfo iStartThreadInfo;
   1.784 +		/** Information which is specific to the Add Process event. */
   1.785 +		TAddProcessInfo iAddProcessInfo;
   1.786 +		/** Information which is specific to the Remove Process event. */
   1.787 +		TRemoveProcessInfo iRemoveProcessInfo;
   1.788 +		};
   1.789 +	};
   1.790 +
   1.791 +/**
   1.792 +  @internalComponent
   1.793 +  */
   1.794 +class TProcessInfo
   1.795 +	{
   1.796 +	public:
   1.797 +
   1.798 +		inline TProcessInfo() { Reset(); }
   1.799 +
   1.800 +		inline TProcessInfo(TUint32 aId, TUint32 aCodeAddress, TUint32 aCodeSize, TUint32 aDataAddress)
   1.801 +				: iId(aId),
   1.802 +				  iCodeAddress(aCodeAddress),
   1.803 +				  iCodeSize(aCodeSize),
   1.804 +				  iDataAddress(aDataAddress) { }
   1.805 +
   1.806 +		inline void Reset()
   1.807 +			{
   1.808 +			iId = 0;
   1.809 +			iCodeAddress = 0;
   1.810 +			iCodeSize = 0;
   1.811 +			iDataAddress = 0;
   1.812 +			}
   1.813 +
   1.814 +	public:
   1.815 +
   1.816 +		TUint32 iId;
   1.817 +		TUint32 iCodeAddress;
   1.818 +		TUint32 iCodeSize;
   1.819 +		TUint32 iDataAddress;
   1.820 +	};
   1.821 +
   1.822 +/* Other functionality may be defined here later */
   1.823 +
   1.824 +/**
   1.825 +Represents a register id value, in the terms of the Symbian ELF format:
   1.826 + - bits 0-7 define the class
   1.827 + - bits 8-15 define the rd_id
   1.828 + - bits 16-31 define the rd_sub_id
   1.829 +
   1.830 +Both the core registers (TFunctionalityRegister type) and the coprocessor registers
   1.831 +follow this identifier scheme.
   1.832 +*/
   1.833 +typedef TUint32 TRegisterInfo;
   1.834 +
   1.835 +/**
   1.836 +Enum representing the status flags which could be returned from a register
   1.837 +access call.
   1.838 +*/
   1.839 +enum TRegisterFlag
   1.840 +	{
   1.841 +	/**
   1.842 +	Default value, a register access call will never return this value
   1.843 +	*/
   1.844 +	ENotSet = 0,
   1.845 +	/**
   1.846 +	Would be returned if the register is supported by the debug driver but the kernel cannot access the register
   1.847 +	*/
   1.848 +	EInValid = 1,
   1.849 +	/**
   1.850 +	Would be returned if the register could be accessed correctly
   1.851 +	*/
   1.852 +	EValid = 2,
   1.853 +	/**
   1.854 +	Would be returned if the register is not supported by the debug driver
   1.855 +	*/
   1.856 +	ENotSupported = 3,
   1.857 +	/**
   1.858 +	Would be returned if a non-4 byte register value was requested
   1.859 +	*/
   1.860 +	EBadSize = 4
   1.861 +	};
   1.862 +
   1.863 +/**
   1.864 +Enum representing the different ARM CPU instruction set architectures.
   1.865 +*/
   1.866 +enum TArchitectureMode
   1.867 +	{
   1.868 +	/** Represents the ARM CPU architecture. */
   1.869 +	EArmMode = 1,
   1.870 +	/** Represents the Thumb CPU architecture. */
   1.871 +	EThumbMode = 2,
   1.872 +	/**
   1.873 +	  Represents the Thumb2 CPU architecture.
   1.874 +	  @prototype
   1.875 +	  */
   1.876 +	EThumb2EEMode = 3
   1.877 +	};
   1.878 +
   1.879 +/**
   1.880 +  Used as an identifier for breakpoints set by the RSecuritySvrSession::SetBreak function.
   1.881 +  @see RSecuritySvrSession
   1.882 +  */
   1.883 +typedef TInt32 TBreakId;
   1.884 +
   1.885 +/**
   1.886 +  Specifies the type of a code segment.
   1.887 +  @see TCodeSegListEntry
   1.888 +  */
   1.889 +enum TCodeSegType
   1.890 +	{
   1.891 +	EUnknownCodeSegType = 0, /**< Signifies an unknown code segment type. */
   1.892 +	EExeCodeSegType = 1,     /**< Signifies a code segment belonging to an executable. */
   1.893 +	EDllCodeSegType = 2      /**< Signifies a code segment belonging to a library. */
   1.894 +	};
   1.895 +
   1.896 +/**
   1.897 +Structure used for extracting data from a descriptor returned by a call to
   1.898 +RSecuritySvrSession::GetList() when GetList() is called with TListId::ECodeSegs
   1.899 +as the first argument.
   1.900 +
   1.901 +@see RSecuritySvrSession::GetList()
   1.902 +
   1.903 +@code
   1.904 +//buffer is a TDesC8 containing 4-byte aligned TCodeSegListEntry objects
   1.905 +//create a pointer to the start of the data
   1.906 +TUint8* ptr = (TUint8*)buffer.Ptr();
   1.907 +//create a pointer to the end of the data
   1.908 +const TUint8* ptrEnd = ptr + buffer.Length();
   1.909 +while(ptr < ptrEnd)
   1.910 +	{
   1.911 +	//cast the pointer to be a TCodeSegListEntry object
   1.912 +	TCodeSegListEntry& entry = *(TCodeSegListEntry*)ptr;
   1.913 +	//use the TCodeSegListEntry pointer, i.e.
   1.914 +	TUint16 nameLength = entry.iNameLength;
   1.915 +	TPtr name(&(entry.iName[0]), nameLength, nameLength);
   1.916 +	// move ptr on to point to the next TCodeSegListEntry object
   1.917 +	ptr += Align4(entry.GetSize());
   1.918 +	}
   1.919 +@endcode
   1.920 +*/
   1.921 +class TCodeSegListEntry
   1.922 +	{
   1.923 +public:
   1.924 +	TInt GetSize() const;
   1.925 +public:
   1.926 +	/**
   1.927 +	  Address of the start of the code segment.
   1.928 +	  */
   1.929 +	TUint32 iCodeBase;
   1.930 +	/**
   1.931 +	  Size of the code segment.
   1.932 +	  */
   1.933 +	TUint32 iCodeSize;
   1.934 +	/**
   1.935 +	  Size of the const data segment
   1.936 +	  */
   1.937 +	TUint32 iConstDataSize;
   1.938 +	/**
   1.939 +	  Address of the initialised data
   1.940 +	  */
   1.941 +	TUint32 iInitialisedDataBase;
   1.942 +	/**
   1.943 +	  Size of the initialised data
   1.944 +	  */
   1.945 +	TUint32 iInitialisedDataSize;
   1.946 +	/**
   1.947 +	  Size of the uninitialised data
   1.948 +	  */
   1.949 +	TUint32 iUninitialisedDataSize;
   1.950 +	/**
   1.951 +	  Boolean indicating whether the code segment is execute in place
   1.952 +	  */
   1.953 +	TBool iIsXip;
   1.954 +	/**
   1.955 +	  Indicates whether the code segment is from an executable or a dll, or neither
   1.956 +	  */
   1.957 +	TCodeSegType iCodeSegType;
   1.958 +	/** Uid3 of this segment. */
   1.959 +	TUint32 iUid3;
   1.960 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
   1.961 +	TUint32 iSpare2;
   1.962 +	/**
   1.963 +	  Length of the code segment's name
   1.964 +	  */
   1.965 +	TUint16 iNameLength;
   1.966 +	/**
   1.967 +	  First two bytes of the code segment's name, the name should be considered to
   1.968 +	  extend past the end of the TCodeSegListEntry structure to a length
   1.969 +	  corresponding to iNameLength
   1.970 +	  */
   1.971 +	TUint16 iName[1];
   1.972 +	};
   1.973 +
   1.974 +/**
   1.975 +Returns the size of the TCodeSegListEntry, including the file name length
   1.976 +
   1.977 +@return the size, in bytes, of the TCodeSegListEntry and the code segment's
   1.978 +file name
   1.979 +*/
   1.980 +inline TInt TCodeSegListEntry::GetSize() const
   1.981 +	{
   1.982 +	return sizeof(TCodeSegListEntry) - sizeof(iName) + (2 * iNameLength);
   1.983 +	}
   1.984 +
   1.985 +/**
   1.986 +Structure used for extracting data from a descriptor returned by a call to
   1.987 +RSecuritySvrSession::GetList() when GetList() is called with TListId::EXipLibraries
   1.988 +as the first argument.
   1.989 +
   1.990 +@see RSecuritySvrSession::GetList()
   1.991 +
   1.992 +@code
   1.993 +//buffer is a TDesC8 containing 4-byte aligned TXipLibraryListEntry objects
   1.994 +//create a pointer to the start of the data
   1.995 +TUint8* ptr = (TUint8*)buffer.Ptr();
   1.996 +//create a pointer to the end of the data
   1.997 +const TUint8* ptrEnd = ptr + buffer.Length();
   1.998 +while(ptr < ptrEnd)
   1.999 +	{
  1.1000 +	//cast the pointer to be a TXipLibraryListEntry object
  1.1001 +	TXipLibraryListEntry& entry = *(TXipLibraryListEntry*)ptr;
  1.1002 +	//use the TXipLibraryListEntry pointer, i.e.
  1.1003 +	TUint16 nameLength = entry.iNameLength;
  1.1004 +	TPtr name(&(entry.iName[0]), nameLength, nameLength);
  1.1005 +	// move ptr on to point to the next TXipLibraryListEntry object
  1.1006 +	ptr += Align4(entry.GetSize());
  1.1007 +	}
  1.1008 +@endcode
  1.1009 +*/
  1.1010 +class TXipLibraryListEntry
  1.1011 +	{
  1.1012 +public:
  1.1013 +	TInt GetSize() const;
  1.1014 +public:
  1.1015 +	/**
  1.1016 +	  Address of the start of the library's code segment.
  1.1017 +	  */
  1.1018 +	TUint32 iCodeBase;
  1.1019 +	/**
  1.1020 +	  Size of the code segment.
  1.1021 +	  */
  1.1022 +	TUint32 iCodeSize;
  1.1023 +	/**
  1.1024 +	  Size of the const data segment
  1.1025 +	  */
  1.1026 +	TUint32 iConstDataSize;
  1.1027 +	/**
  1.1028 +	  Address of the initialised data
  1.1029 +	  */
  1.1030 +	TUint32 iInitialisedDataBase;
  1.1031 +	/**
  1.1032 +	  Size of the initialised data
  1.1033 +	  */
  1.1034 +	TUint32 iInitialisedDataSize;
  1.1035 +	/**
  1.1036 +	  Size of the uninitialised data
  1.1037 +	  */
  1.1038 +	TUint32 iUninitialisedDataSize;
  1.1039 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
  1.1040 +	TUint32 iSpare1;
  1.1041 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
  1.1042 +	TUint32 iSpare2;
  1.1043 +	/**
  1.1044 +	  Length of the library's name
  1.1045 +	  */
  1.1046 +	TUint16 iNameLength;
  1.1047 +	/**
  1.1048 +	  First two bytes of the code segment's name, the name should be considered to
  1.1049 +	  extend past the end of the TXipLibraryListEntry structure to a length
  1.1050 +	  corresponding to iNameLength
  1.1051 +	  */
  1.1052 +	TUint16 iName[1];
  1.1053 +	};
  1.1054 +
  1.1055 +/**
  1.1056 +Returns the size of the TXipLibraryListEntry, including the file name length
  1.1057 +
  1.1058 +@return the size, in bytes, of the TXipLibraryListEntry and the library's
  1.1059 +file name
  1.1060 +*/
  1.1061 +inline TInt TXipLibraryListEntry::GetSize() const
  1.1062 +	{
  1.1063 +	return sizeof(TXipLibraryListEntry) - sizeof(iName) + (2 * iNameLength);
  1.1064 +	}
  1.1065 +
  1.1066 +/**
  1.1067 +Structure used for extracting data from a descriptor returned by a call to
  1.1068 +RSecuritySvrSession::GetList() when GetList() is called with TListId::EExecutables
  1.1069 +as the first argument.
  1.1070 +
  1.1071 +@see RSecuritySvrSession::GetList()
  1.1072 +
  1.1073 +@code
  1.1074 +//buffer is a TDesC8 containing 4-byte aligned TExecutablesListEntry objects
  1.1075 +//create a pointer to the start of the data
  1.1076 +TUint8* ptr = (TUint8*)buffer.Ptr();
  1.1077 +//create a pointer to the end of the data
  1.1078 +const TUint8* ptrEnd = ptr + buffer.Length();
  1.1079 +while(ptr < ptrEnd)
  1.1080 +	{
  1.1081 +	//cast the pointer to be a TExecutablesListEntry object
  1.1082 +	TExecutablesListEntry& entry = *(TExecutablesListEntry*)ptr;
  1.1083 +	//use the TExecutablesListEntry pointer, i.e.
  1.1084 +	TUint16 nameLength = entry.iNameLength;
  1.1085 +	TPtr name(&(entry.iName[0]), nameLength, nameLength);
  1.1086 +	// move ptr on to point to the next TExecutablesListEntry object
  1.1087 +	ptr += Align4(entry.GetSize());
  1.1088 +	}
  1.1089 +@endcode
  1.1090 +*/
  1.1091 +class TExecutablesListEntry
  1.1092 +	{
  1.1093 +public:
  1.1094 +	TInt GetSize() const;
  1.1095 +public:
  1.1096 +	/**
  1.1097 +	  Indicates whether an agent has registered to actively debug the executable,
  1.1098 +	  a non-zero value indicates that an agent has attached.
  1.1099 +	  */
  1.1100 +	TUint8 iIsActivelyDebugged;
  1.1101 +	/**
  1.1102 +	  Indicates whether any agents have registered to passively debug the executable,
  1.1103 +	  a non-zero value indicates that at least one agent is attached passively
  1.1104 +	  */
  1.1105 +	TUint8 iIsPassivelyDebugged;
  1.1106 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
  1.1107 +	TUint32 iSpare1;
  1.1108 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
  1.1109 +	TUint32 iSpare2;
  1.1110 +	/**
  1.1111 +	  Length of the executable's name
  1.1112 +	  */
  1.1113 +	TUint16 iNameLength;
  1.1114 +	/**
  1.1115 +	  First two bytes of the executable's name, the name should be considered to
  1.1116 +	  extend past the end of the TExecutablesListEntry structure to a length
  1.1117 +	  corresponding to iNameLength
  1.1118 +	  */
  1.1119 +	TUint16 iName[1];
  1.1120 +	};
  1.1121 +
  1.1122 +/**
  1.1123 +Returns the size of the TExecutablesListEntry, including the file name length
  1.1124 +
  1.1125 +@return the size, in bytes, of the TExecutablesListEntry and the executable's
  1.1126 +file name
  1.1127 +*/
  1.1128 +inline TInt TExecutablesListEntry::GetSize() const
  1.1129 +	{
  1.1130 +	return sizeof(TExecutablesListEntry) - sizeof(iName) + (2*iNameLength);
  1.1131 +	}
  1.1132 +
  1.1133 +/**
  1.1134 +Structure used for extracting data from a descriptor returned by a call to
  1.1135 +RSecuritySvrSession::GetList() when GetList() is called with TListId::EProcesses
  1.1136 +as the first argument.
  1.1137 +
  1.1138 +@see RSecuritySvrSession::GetList()
  1.1139 +
  1.1140 +@code
  1.1141 +//buffer is a TDesC8 containing 4-byte aligned TProcessListEntry objects
  1.1142 +//create a pointer to the start of the data
  1.1143 +TUint8* ptr = (TUint8*)buffer.Ptr();
  1.1144 +//create a pointer to the end of the data
  1.1145 +const TUint8* ptrEnd = ptr + buffer.Length();
  1.1146 +while(ptr < ptrEnd)
  1.1147 +	{
  1.1148 +	//cast the pointer to be a TProcessListEntry object
  1.1149 +	TProcessListEntry& entry = *(TProcessListEntry*)ptr;
  1.1150 +	//use the TProcessListEntry pointer, i.e.
  1.1151 +	TUint16 fileNameLength = entry.iFileNameLength;
  1.1152 +	TPtr name(&(entry.iNames[0]), fileNameLength, fileNameLength);
  1.1153 +	// move ptr on to point to the next TProcessListEntry object
  1.1154 +	ptr += Align4(entry.GetSize());
  1.1155 +	}
  1.1156 +@endcode
  1.1157 +*/
  1.1158 +class TProcessListEntry
  1.1159 +	{
  1.1160 +	public:
  1.1161 +		TInt GetSize() const;
  1.1162 +
  1.1163 +	public:
  1.1164 +		/** Process ID */
  1.1165 +		TUint64 iProcessId;
  1.1166 +
  1.1167 +		/** The Uid3 of the process */
  1.1168 +		TUint32 iUid3;
  1.1169 +
  1.1170 +		/** 
  1.1171 +		 * Process Attributes
  1.1172 +		 * @see DProcess::TProcessAttributes
  1.1173 +		 */
  1.1174 +		TInt iAttributes;
  1.1175 +
  1.1176 +		/**
  1.1177 +		 * Length of fully qualified file name of the process in bytes. Note that this
  1.1178 +		 * entry may be 0 if the process is in the process of shutting down.
  1.1179 +		 */
  1.1180 +		TUint16 iFileNameLength;
  1.1181 +
  1.1182 +		/**
  1.1183 +		 * Length of current dynamic name of the process in bytes
  1.1184 +		 */
  1.1185 +		TUint16 iDynamicNameLength;
  1.1186 +
  1.1187 +		/**
  1.1188 +		 * First two bytes of the process' file name, the name should be considered to
  1.1189 +		 * extend past the end of the TProcessListEntry structure to a length
  1.1190 +		 * corresponding to iFileNameLength. Directly after the data corresponding to the
  1.1191 +		 * file name, the dynamic name is stored with a length of iDynamicNameLength characters.
  1.1192 +		 * Note that these names are not null terminated and are concatenated directly after each other.
  1.1193 +		 * 
  1.1194 +		 * @code
  1.1195 +		 * TProcessListEntry& entry; // entry is a reference to a TProcessListEntry
  1.1196 +		 *
  1.1197 +		 * //get the file name..
  1.1198 +		 * TPtr fileName(&(entry.iNames[0]), iFileNameLength, iFileNameLength);
  1.1199 +		 *
  1.1200 +		 * //get the dynamic name length..
  1.1201 +		 * TPtr dynamicName(&(entry.iNames[0]) + iFileNameLength, iDynamicNameLength, iDynamicNameLength);
  1.1202 +		 * @endcode
  1.1203 +		 */
  1.1204 +		TUint16 iNames[1];
  1.1205 +	};
  1.1206 +
  1.1207 +/**
  1.1208 +Returns the size of the TProcessListEntry, including the file name length and the
  1.1209 +dynamic name length
  1.1210 +
  1.1211 +@return the size, in bytes, of the TProcessListEntry and the executable's
  1.1212 +file name file name and dynamic name
  1.1213 +*/
  1.1214 +inline TInt TProcessListEntry::GetSize() const
  1.1215 +	{
  1.1216 +	return sizeof(TProcessListEntry) - sizeof(iNames) + (2 * (iFileNameLength + iDynamicNameLength));
  1.1217 +	}
  1.1218 +
  1.1219 +/**
  1.1220 +Structure used for extracting data from a descriptor returned by a call to
  1.1221 +RSecuritySvrSession::GetList() when GetList() is called with TListId::EThreads
  1.1222 +as the first argument.
  1.1223 +
  1.1224 +@see RSecuritySvrSession::GetList()
  1.1225 +
  1.1226 +@code
  1.1227 +//buffer is a TDesC8 containing 4-byte aligned TThreadListEntry objects
  1.1228 +//create a pointer to the start of the data
  1.1229 +TUint8* ptr = (TUint8*)buffer.Ptr();
  1.1230 +//create a pointer to the end of the data
  1.1231 +const TUint8* ptrEnd = ptr + buffer.Length();
  1.1232 +while(ptr < ptrEnd)
  1.1233 +	{
  1.1234 +	//cast the pointer to be a TThreadListEntry object
  1.1235 +	TThreadListEntry& entry = *(TThreadListEntry*)ptr;
  1.1236 +	//use the TThreadListEntry pointer, i.e.
  1.1237 +	TUint16 nameLength = entry.iNameLength;
  1.1238 +	TPtr name(&(entry.iName[0]), nameLength, nameLength);
  1.1239 +	// move ptr on to point to the next TThreadListEntry object
  1.1240 +	ptr += Align4(entry.GetSize());
  1.1241 +	}
  1.1242 +@endcode
  1.1243 +*/
  1.1244 +class TThreadListEntry
  1.1245 +	{
  1.1246 +public:
  1.1247 +	TInt GetSize() const;
  1.1248 +public:
  1.1249 +	/**
  1.1250 +	  Thread ID
  1.1251 +	  */
  1.1252 +	TUint64 iThreadId;
  1.1253 +	/**
  1.1254 +	  Process ID
  1.1255 +	  */
  1.1256 +	TUint64 iProcessId;
  1.1257 +	/**
  1.1258 +	  Address of the base of the supervisor stack
  1.1259 +	  */
  1.1260 +	TUint32 iSupervisorStackBase;
  1.1261 +	/**
  1.1262 +	  Size of the supervisor stack
  1.1263 +	  */
  1.1264 +	TUint32 iSupervisorStackSize;
  1.1265 +	/**
  1.1266 +	  Non-zero if iSupervisorStackBase has been set correctly
  1.1267 +	  */
  1.1268 +	TUint8 iSupervisorStackBaseValid;
  1.1269 +	/**
  1.1270 +	  Non-zero if iSupervisorStackSize has been set correctly
  1.1271 +	  */
  1.1272 +	TUint8 iSupervisorStackSizeValid;
  1.1273 +	/**
  1.1274 +	  Address of the thread's supervisor stack pointer
  1.1275 +	  */
  1.1276 +	TUint32 iSupervisorStackPtr;
  1.1277 +	/**
  1.1278 +	  Indicator of whether the value returned as iSupervisorStackPtr is valid.
  1.1279 +	  It is necessary, but not necessarily sufficient, that the thread be suspended
  1.1280 +	  for a valid value to be returned. This may be removed from the final API and
  1.1281 +	  the value would be extracted instead via the ReadRegisters type calls.
  1.1282 +	  */
  1.1283 +	TRegisterFlag iSupervisorStackPtrValid;
  1.1284 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
  1.1285 +	TUint32 iSpare1;
  1.1286 +	/** Currently unused element. May be used in future to aid maintaining compatibility. */
  1.1287 +	TUint32 iSpare2;
  1.1288 +	/**
  1.1289 +	  The length of the thread's name
  1.1290 +	  */
  1.1291 +	TUint16 iNameLength;
  1.1292 +	/**
  1.1293 +	  First two bytes of the thread's name, the name should be considered to
  1.1294 +	  extend past the end of the TThreadListEntry structure to a length
  1.1295 +	  corresponding to iNameLength
  1.1296 +	  */
  1.1297 +	TUint16 iName[1];
  1.1298 +	};
  1.1299 +
  1.1300 +/**
  1.1301 +Returns the size of the TThreadListEntry, including the name length
  1.1302 +
  1.1303 +@return the size, in bytes, of the TExecutablesListEntry and the thread's name
  1.1304 +*/
  1.1305 +inline TInt TThreadListEntry::GetSize() const
  1.1306 +	{
  1.1307 +	return sizeof(TThreadListEntry) - sizeof(iName) + (2 * iNameLength);
  1.1308 +	}
  1.1309 +
  1.1310 +/**
  1.1311 +Denotes which list type to return from a RSecuritySvrSession::GetList() call
  1.1312 +
  1.1313 +@see RSecuritySvrSession::GetList()
  1.1314 +*/
  1.1315 +enum TListId
  1.1316 +	{
  1.1317 +	/**
  1.1318 +	Indicates that the GetList() call should return a list of the processes in
  1.1319 +	the system. The returned buffer will contain an array of 4-byte aligned
  1.1320 +	TProcessListEntry objects.
  1.1321 +
  1.1322 +	@see TProcessListEntry
  1.1323 +	*/
  1.1324 +	EProcesses = 0,
  1.1325 +	/**
  1.1326 +	Indicates that the GetList() call should return a list of the threads in
  1.1327 +	the system. The returned buffer will contain an array of 4-byte aligned
  1.1328 +	TThreadListEntry objects.
  1.1329 +
  1.1330 +	@see TThreadListEntry
  1.1331 +	*/
  1.1332 +	EThreads = 1,
  1.1333 +	/**
  1.1334 +	Indicates that the GetList() call should return a list of the code segments in
  1.1335 +	the system. The returned buffer will contain an array of 4-byte aligned
  1.1336 +	TCodeSegListEntry objects.
  1.1337 +
  1.1338 +	@see TCodeSegListEntry
  1.1339 +	*/
  1.1340 +	ECodeSegs = 2,
  1.1341 +	/**
  1.1342 +	Indicates that the GetList() call should return a list of the XIP libraries in
  1.1343 +	the system. The returned buffer will contain an array of 4-byte aligned
  1.1344 +	EXipLibraries objects.
  1.1345 +
  1.1346 +	@see EXipLibraries
  1.1347 +	*/
  1.1348 +	EXipLibraries = 3,
  1.1349 +	/**
  1.1350 +	Indicates that the GetList() call should return a list of the executables in
  1.1351 +	the system. The returned buffer will contain an array of 4-byte aligned
  1.1352 +	EExecutables objects.
  1.1353 +
  1.1354 +	@see EExecutables
  1.1355 +	*/
  1.1356 +	EExecutables = 4,
  1.1357 +	/**
  1.1358 +	Indicates that the GetList() call should return a list of the logical devices in the system.
  1.1359 +	*/
  1.1360 +	ELogicalDevices = 5,
  1.1361 +	/**
  1.1362 +	Indicates that the GetList() call should return a list of the mutexes in the system.
  1.1363 +	*/
  1.1364 +	EMutexes = 6,
  1.1365 +	/**
  1.1366 +	Indicates that the GetList() call should return a list of the servers in the system.
  1.1367 +	*/
  1.1368 +	EServers = 7,
  1.1369 +	/**
  1.1370 +	Indicates that the GetList() call should return a list of the sessions in the system.
  1.1371 +	*/
  1.1372 +	ESessions = 8,
  1.1373 +	/**
  1.1374 +	Indicates that the GetList() call should return a list of the semaphores in the system.
  1.1375 +	*/
  1.1376 +	ESemaphores = 9,
  1.1377 +	/**
  1.1378 +	Indicates that the GetList() call should return a list of the chunks in the system.
  1.1379 +	*/
  1.1380 +	EChunks = 10,
  1.1381 +
  1.1382 +	/**
  1.1383 +	Provides a complete list of all the breakpoints in the system and their
  1.1384 +	current state.
  1.1385 +
  1.1386 +	@see EBreakpoints
  1.1387 +	*/
  1.1388 +	EBreakpoints = 11,
  1.1389 +
  1.1390 +	/** 
  1.1391 +	The following are for the possible use of kernel-side debug and SMP breakpoint
  1.1392 +	manipulation.
  1.1393 +	*/
  1.1394 +	ESetBreak = 12,
  1.1395 +	ERemoveBreak = 13,
  1.1396 +	EModifyBreak = 14,
  1.1397 +	
  1.1398 +	/**
  1.1399 +	 * Provides static information of the system
  1.1400 +	 */
  1.1401 +	EStaticInfo = 15,
  1.1402 +
  1.1403 +	/** Last listing enum. */
  1.1404 +	EListLast
  1.1405 +	};
  1.1406 +
  1.1407 +/**
  1.1408 +  Bit field values denoting the scope of a listing.
  1.1409 +
  1.1410 +  In the debug functionality block, the TTag::iValue element which is returned for a listing tag
  1.1411 +  should be considered as a union of the supported values from this enumeration for that listing.
  1.1412 +  */
  1.1413 +enum TListScope
  1.1414 +	{
  1.1415 +	EScopeNone = 0x0,             /**< Corresponds to no scope for a listing. equivalent to not supported */
  1.1416 +	EScopeGlobal= 0x1,            /**< Corresponds to a global scope for a listing. */
  1.1417 +	EScopeProcessSpecific = 0x2,  /**< Corresponds to a process specific scope for a listing. */
  1.1418 +	EScopeThreadSpecific = 0x4    /**< Corresponds to a thread specific scope for a listing. */
  1.1419 +	};
  1.1420 +
  1.1421 +/**
  1.1422 +@internalComponent
  1.1423 +
  1.1424 +Interface constructor for passing IPC data for the GetList call.
  1.1425 +*/
  1.1426 +class TListDetails
  1.1427 +	{
  1.1428 +public:
  1.1429 +	TListDetails(const TListId aListId, const TListScope aListScope, TUint64 aTargetId=0)
  1.1430 +		: iListId(aListId),
  1.1431 +		  iListScope(aListScope),
  1.1432 +		  iTargetId(aTargetId) {}
  1.1433 +public:
  1.1434 +	TListId iListId;
  1.1435 +	TListScope iListScope;
  1.1436 +	TUint64 iTargetId;
  1.1437 +	};
  1.1438 +
  1.1439 +/** Debug Security Server Secure ID */
  1.1440 +const TUid KUidDebugSecurityServer = { 0x102834E2 };
  1.1441 +
  1.1442 +} // end of Debug namespace declaration
  1.1443 +
  1.1444 +// the remaining functionality in this file is intended for use on user side only
  1.1445 +#ifndef __KERNEL_MODE__
  1.1446 +
  1.1447 +#include <e32std.h>
  1.1448 +
  1.1449 +// API definition for Debug namespace appears elsewhere in this file.
  1.1450 +namespace Debug {
  1.1451 +
  1.1452 +/** The name of the Debug Security Server. */
  1.1453 +_LIT(KSecurityServerName,"DebugSecurityServer");
  1.1454 +
  1.1455 +// A version must be specified when creating a session with the server
  1.1456 +/** The Debug Security Server's major version number. */
  1.1457 +const TUint KDebugServMajorVersionNumber=2;
  1.1458 +/** The Debug Security Server's minor version number. */
  1.1459 +const TUint KDebugServMinorVersionNumber=4;
  1.1460 +/** The Debug Security Server's patch version number. */
  1.1461 +const TUint KDebugServPatchVersionNumber=0;
  1.1462 +
  1.1463 +/**
  1.1464 +Denotes how memory should be accessed
  1.1465 +*/
  1.1466 +enum TAccess
  1.1467 +	{
  1.1468 +	EAccess8 = 1,	/**< Currently unsupported, signifies 8 bit access. */
  1.1469 +	EAccess16 = 2,	/**< Currently unsupported, signifies 16 bit access. */
  1.1470 +	EAccess32 = 4	/**< Signifies 32 bit access. */
  1.1471 +	};
  1.1472 +
  1.1473 +/**
  1.1474 +Denotes how data should be interpreted
  1.1475 +*/
  1.1476 +enum TEndianess
  1.1477 +	{
  1.1478 +	EEndLE8 = 0,	/**< Signifies 8 bit little-endian. */
  1.1479 +	EEndBE8 = 1,	/**< Currently unsupported, signifies 8 bit big-endian. */
  1.1480 +	EEndBE32 = 2	/**< Currently unsupported, signifies 32 bit big-endian. */
  1.1481 +	};
  1.1482 +
  1.1483 +/**
  1.1484 +Structure used to store information about a memory operation
  1.1485 +
  1.1486 +@internalComponent
  1.1487 +*/
  1.1488 +class TMemoryInfo
  1.1489 +	{
  1.1490 +public:
  1.1491 +
  1.1492 +	TMemoryInfo(TUint32 aAddress=0, TUint32 aLength=0, TAccess aAccess=EAccess32, TEndianess aEndianess=EEndLE8)
  1.1493 +		: iAddress(aAddress),
  1.1494 +		  iSize(aLength),
  1.1495 +		  iAccess(aAccess),
  1.1496 +		  iEndianess(aEndianess)
  1.1497 +		{}
  1.1498 +
  1.1499 +public:
  1.1500 +
  1.1501 +	/**
  1.1502 +	Address to start reading/writing memory
  1.1503 +	*/
  1.1504 +	TUint32 iAddress;
  1.1505 +	/**
  1.1506 +	Number of bytes of memory to read/write
  1.1507 +	*/
  1.1508 +	TUint32	iSize;
  1.1509 +	/**
  1.1510 +	Access size for read/write
  1.1511 +	@see TAccess
  1.1512 +	*/
  1.1513 +	TAccess iAccess;
  1.1514 +	/**
  1.1515 +	Endianess to interpret data as
  1.1516 +	@see TEndianess
  1.1517 +	*/
  1.1518 +	TEndianess iEndianess;
  1.1519 +	};
  1.1520 +
  1.1521 +/**
  1.1522 +@internalComponent
  1.1523 +*/
  1.1524 +class TBreakInfo
  1.1525 +	{
  1.1526 +public:
  1.1527 +	TUint32 iAddress;
  1.1528 +	TArchitectureMode iArchitectureMode;
  1.1529 +	};
  1.1530 +
  1.1531 +/**
  1.1532 +@internalComponent
  1.1533 +
  1.1534 +Function codes (opcodes) used in message passing between client and server
  1.1535 +in this header file and what arguments should be passed with each of these
  1.1536 +*/
  1.1537 +enum TDebugServRqst
  1.1538 +	{
  1.1539 +	EDebugServOpen = 1,
  1.1540 +	EDebugServClose = 2,
  1.1541 +	EDebugServSuspendThread = 3,
  1.1542 +	EDebugServResumeThread = 4,
  1.1543 +	EDebugServReadMemory = 5,
  1.1544 +	EDebugServWriteMemory = 6,
  1.1545 +	EDebugServSetBreak = 7,
  1.1546 +	EDebugServClearBreak = 8,
  1.1547 +	EDebugServModifyBreak = 9,
  1.1548 +	EDebugServGetEvent = 10,
  1.1549 +	EDebugServCancelGetEvent = 11,
  1.1550 +	EDebugServAttachExecutable = 12,
  1.1551 +	EDebugServDetachExecutable = 13,
  1.1552 +	EDebugServGetDebugFunctionalityBufSize = 14,
  1.1553 +	EDebugServGetDebugFunctionality = 15,
  1.1554 +	EDebugServReadRegisters = 16,
  1.1555 +	EDebugServWriteRegisters = 17,
  1.1556 +	EDebugServSetEventAction = 18,
  1.1557 +	EDebugServBreakInfo = 19,
  1.1558 +	EDebugServGetList = 20,
  1.1559 +	EDebugServStep = 21,
  1.1560 +	EDebugServSetProcessBreak = 22,
  1.1561 +	EDebugServProcessBreakInfo = 23,
  1.1562 +	EDebugServKillProcess = 24,
  1.1563 +	EDebugServModifyProcessBreak = 25,
  1.1564 +	EDebugServReadCrashFlash = 26,
  1.1565 +	EDebugServWriteCrashFlash = 27,
  1.1566 +	EDebugServEraseCrashFlash = 28,
  1.1567 +	EDebugServEraseEntireCrashFlash = 29,
  1.1568 +	};
  1.1569 +
  1.1570 +/**
  1.1571 +Client side API to debug security server (DSS). Interaction with the DSS should
  1.1572 +be conducted through this class only.
  1.1573 +*/
  1.1574 +class RSecuritySvrSession : public RSessionBase
  1.1575 +	{
  1.1576 +public:
  1.1577 +	RSecuritySvrSession();
  1.1578 +	TVersion Version() const;
  1.1579 +
  1.1580 +	TInt Close();
  1.1581 +
  1.1582 +	TInt AttachExecutable(const TDesC& aProcessName, TBool aPassive);
  1.1583 +	TInt DetachExecutable(const TDesC& aProcessName);
  1.1584 +
  1.1585 +	TInt GetDebugFunctionalityBufSize(TUint32* aBufSize);
  1.1586 +	TInt GetDebugFunctionality(TDes8& aBuffer);
  1.1587 +
  1.1588 +	TInt SuspendThread(const TThreadId aThreadId);
  1.1589 +	TInt ResumeThread(const TThreadId aThreadId);
  1.1590 +
  1.1591 +	TInt ReadMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData, const TAccess aAccessSize, const TEndianess aEndianess);
  1.1592 +	TInt WriteMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData, const TAccess aAccessSize, const TEndianess aEndianess);
  1.1593 +
  1.1594 +	TInt ReadRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, TDes8& aRegisterValues, TDes8& aRegisterFlags);
  1.1595 +	TInt WriteRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, const TDesC8& aRegisterValues, TDes8& aRegisterFlags);
  1.1596 +
  1.1597 +	void GetEvent(const TDesC& aExecutableName, TRequestStatus &aStatus, TDes8& aEventInfo);
  1.1598 +	TInt CancelGetEvent(const TDesC& aExecutableName);
  1.1599 +
  1.1600 +	TInt SetEventAction(const TDesC& aExecutableName, TEventType aEvent, TKernelEventAction aEventAction);
  1.1601 +
  1.1602 +	TInt SetBreak( TBreakId &aId, const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode);
  1.1603 +	TInt ClearBreak(const TBreakId aBreakId);
  1.1604 +	TInt ModifyBreak(const TBreakId aBreakId, const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode);
  1.1605 +	TInt BreakInfo(const TBreakId aBreakId, TThreadId& aThreadId, TUint32& aAddress, TArchitectureMode& aMode);
  1.1606 +	TInt SetProcessBreak( TBreakId &aId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode);
  1.1607 +	TInt ProcessBreakInfo(const TBreakId aBreakId, TProcessId& aProcessId, TUint32& aAddress, TArchitectureMode& aMode);
  1.1608 +	TInt ModifyProcessBreak(const TBreakId aBreakId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode);
  1.1609 +			
  1.1610 +	TInt GetList(const TListId aListId, TDes8& aListData, TUint32& aDataSize);
  1.1611 +	TInt GetList(const TThreadId aThreadId, const TListId aListId, TDes8& aListData, TUint32& aDataSize);
  1.1612 +	TInt GetList(const TProcessId aProcessId, const TListId aListId, TDes8& aListData, TUint32& aDataSize);
  1.1613 +	TInt Step(const TThreadId aThreadId, TUint32 aNumSteps);
  1.1614 +	TInt KillProcess(const TProcessId aProcessId, const TInt aReason);
  1.1615 +	TInt ReadCrashLog(const TUint32 aPos, TDes8& aData, const TUint32 aDataSize);	
  1.1616 +	TInt WriteCrashConfig(const TUint32 aPos, const TDesC8& aBuffer, TUint32& aSize);
  1.1617 +	TInt EraseCrashLog(const TUint32 aPos, const TUint32 aBlockNumber);
  1.1618 +	TInt EraseCrashFlashPartition();
  1.1619 +	
  1.1620 +	TInt Connect(const TVersion aVersion);
  1.1621 +private:
  1.1622 +	TInt StartServer(void);
  1.1623 +	};
  1.1624 +/**
  1.1625 +Server session constructor
  1.1626 +*/
  1.1627 +inline RSecuritySvrSession::RSecuritySvrSession()
  1.1628 +	{
  1.1629 +
  1.1630 +	}
  1.1631 +
  1.1632 +/**
  1.1633 +Called by a client to create a session with the DSS. This method starts the
  1.1634 +DSS if it is not running, or connects to it if it already exists.
  1.1635 +
  1.1636 +@param aVersion version of the DSS to connect to
  1.1637 +
  1.1638 +@return KErrNone if a connection was successfully created, or one of the other
  1.1639 +system wide error codes
  1.1640 +*/
  1.1641 +inline TInt RSecuritySvrSession::Connect(const TVersion aVersion)
  1.1642 +	{
  1.1643 +	// default message slots for the server
  1.1644 +	const TUint KDefaultMessageSlots = 4;
  1.1645 +	TInt retry=2;
  1.1646 +	for (;;)
  1.1647 +		{
  1.1648 +		TInt r=CreateSession(KSecurityServerName, aVersion, KDefaultMessageSlots);
  1.1649 +		if (r!=KErrNotFound && r!=KErrServerTerminated)
  1.1650 +			{
  1.1651 +			return r;
  1.1652 +			}
  1.1653 +		if (--retry==0)
  1.1654 +			{
  1.1655 +			return r;
  1.1656 +			}
  1.1657 +		r=StartServer();
  1.1658 +		if (r!=KErrNone && r!=KErrAlreadyExists)
  1.1659 +			{
  1.1660 +			return r;
  1.1661 +			}
  1.1662 +		}
  1.1663 +	}
  1.1664 +
  1.1665 +/**
  1.1666 +  Start the server
  1.1667 +
  1.1668 +  @return KErrNone on success, or one of the other system wide error codes
  1.1669 +  */
  1.1670 +inline TInt RSecuritySvrSession::StartServer()
  1.1671 +	{
  1.1672 +	// constants for the server
  1.1673 +	_LIT(KSecurityServerProcessName, "rm_debug_svr");
  1.1674 +	const TUidType serverUid(KNullUid, KNullUid, KUidDebugSecurityServer);
  1.1675 +
  1.1676 +	RProcess server;
  1.1677 +	TInt err = server.Create(KSecurityServerProcessName, KNullDesC, serverUid);
  1.1678 +
  1.1679 +	if(KErrNone != err)
  1.1680 +		{
  1.1681 +		return err;
  1.1682 +		}
  1.1683 +
  1.1684 +	// Synchronise with the process to make sure it hasn't died straight away
  1.1685 +	TRequestStatus stat;
  1.1686 +	server.Rendezvous(stat);
  1.1687 +	if (stat != KRequestPending)
  1.1688 +		{
  1.1689 +		// logon failed - server is not yet running, so cannot have terminated
  1.1690 +		server.Kill(0);             // Abort startup
  1.1691 +		}
  1.1692 +	else
  1.1693 +		{
  1.1694 +		// logon OK - start the server
  1.1695 +		server.Resume();
  1.1696 +		}
  1.1697 +
  1.1698 +	// Wait to synchronise with server - if it dies in the meantime, it
  1.1699 +	// also gets completed
  1.1700 +	User::WaitForRequest(stat);
  1.1701 +
  1.1702 +	// We can't use the 'exit reason' if the server panicked as this
  1.1703 +	// is the panic 'reason' and may be '0' which cannot be distinguished
  1.1704 +	// from KErrNone
  1.1705 +	err = (server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
  1.1706 +	server.Close();
  1.1707 +	return err;
  1.1708 +	}
  1.1709 +
  1.1710 +/**
  1.1711 +Get version of RSecuritySvrSession
  1.1712 +
  1.1713 +@return a TVersion object specifying the version
  1.1714 +*/
  1.1715 +inline TVersion RSecuritySvrSession::Version(void) const
  1.1716 +	{
  1.1717 +	return (TVersion(KDebugServMajorVersionNumber, KDebugServMinorVersionNumber, KDebugServPatchVersionNumber));
  1.1718 +	}
  1.1719 +
  1.1720 +/**
  1.1721 +Suspends execution of the specified thread.
  1.1722 +
  1.1723 +@param aThreadId thread ID of the thread to suspend
  1.1724 +
  1.1725 +@return KErrNone if there were no problems, KErrPermissionDenied if security 
  1.1726 +        check fails or KErrArgument if the thread does not exist
  1.1727 +*/
  1.1728 +inline TInt RSecuritySvrSession::SuspendThread(const TThreadId aThreadId)
  1.1729 +	{
  1.1730 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.1731 +	TIpcArgs args(&threadIdPckg);
  1.1732 +
  1.1733 +	return SendReceive(EDebugServSuspendThread, args);
  1.1734 +	}
  1.1735 +
  1.1736 +/**
  1.1737 +Resumes execution of the specified thread.
  1.1738 +
  1.1739 +@param aThreadId thread ID of the thread to resume
  1.1740 +
  1.1741 +@return KErrNone if there were no problems, KErrPermissionDenied if security 
  1.1742 +        check fails or KErrArgument if the thread does not exist
  1.1743 +*/
  1.1744 +inline TInt RSecuritySvrSession::ResumeThread(const TThreadId aThreadId)
  1.1745 +	{
  1.1746 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.1747 +	TIpcArgs args(&threadIdPckg);
  1.1748 +
  1.1749 +	return SendReceive(EDebugServResumeThread, args);
  1.1750 +	}
  1.1751 +
  1.1752 +/**
  1.1753 +Purpose:
  1.1754 +Set a thread-specific breakpoint in an attached process. 
  1.1755 +
  1.1756 +@pre Debug Agent must be connected to the debug security server
  1.1757 +@pre Debug Agent must be attached to a process.
  1.1758 +
  1.1759 +@param aThreadId The thread id to which the breakpoint will apply.
  1.1760 +@param aAddress The virtual memory address at which to place the breakpoint.
  1.1761 +@param aArchitectureMode The kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE)
  1.1762 +@param aBreakId The address to which the assigned breakpoint ID will be written by this function
  1.1763 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1764 +*/
  1.1765 +inline TInt RSecuritySvrSession::SetBreak( TBreakId &aBreakId,const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode)
  1.1766 +	{
  1.1767 +	TPtr8 breakIdPtr((TUint8*)&aBreakId, sizeof(aBreakId));
  1.1768 +
  1.1769 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.1770 +
  1.1771 +	TBreakInfo breakInfo;
  1.1772 +	breakInfo.iAddress = aAddress;
  1.1773 +	breakInfo.iArchitectureMode = aArchitectureMode;
  1.1774 +	TPckgBuf<TBreakInfo> breakInfoPckg(breakInfo);
  1.1775 +
  1.1776 +	//call driver to attempt to set break
  1.1777 +	TIpcArgs args(&threadIdPckg, &breakInfoPckg, &breakIdPtr);
  1.1778 +	return SendReceive(EDebugServSetBreak, args);
  1.1779 +	}
  1.1780 +
  1.1781 +/**
  1.1782 +Purpose:
  1.1783 +Clears a previously set thread-specific or process-specific breakpoint.
  1.1784 +
  1.1785 +@pre Debug Agent must be connected to the debug security server
  1.1786 +@pre Debug Agent must be attached to a process.
  1.1787 +
  1.1788 +@param aBreakId The TBreakId returned by a prior SetBreak call. Must have been set by the same Debug Agent.
  1.1789 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1790 +*/
  1.1791 +inline TInt RSecuritySvrSession::ClearBreak(const TBreakId aBreakId)
  1.1792 +	{
  1.1793 +	TIpcArgs args(aBreakId);
  1.1794 +	return SendReceive(EDebugServClearBreak, args);
  1.1795 +	}
  1.1796 +
  1.1797 +/**
  1.1798 +Purpose:
  1.1799 +Modifies the properties of a previously set breakpoint.
  1.1800 +
  1.1801 +@pre Debug Agent must be connected to the debug security server
  1.1802 +@pre Debug Agent must be attached to a process.
  1.1803 +
  1.1804 +@param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent.
  1.1805 +@param aThreadId the thread id of the thread to move the breakpoint to
  1.1806 +@param aAddress the virtual memory address at which to place the breakpoint.
  1.1807 +@param aArchitectureMode the kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE)
  1.1808 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1809 +*/
  1.1810 +inline TInt RSecuritySvrSession::ModifyBreak(const TBreakId aBreakId, const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode)
  1.1811 +
  1.1812 +	{
  1.1813 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.1814 +	TIpcArgs args(aBreakId,&threadIdPckg,aAddress,aArchitectureMode);
  1.1815 +	return SendReceive(EDebugServModifyBreak, args);
  1.1816 +	}
  1.1817 +
  1.1818 +/**
  1.1819 +Purpose:
  1.1820 +Modifies the properties of a previously set process breakpoint.
  1.1821 +
  1.1822 +@pre Debug Agent must be connected to the debug security server
  1.1823 +@pre Debug Agent must be attached to a process.
  1.1824 +
  1.1825 +@param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent.
  1.1826 +@param aProcessId the process id of the process to move the breakpoint to
  1.1827 +@param aAddress the virtual memory address at which to place the breakpoint.
  1.1828 +@param aArchitectureMode the kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE)
  1.1829 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1830 +*/
  1.1831 +inline TInt RSecuritySvrSession::ModifyProcessBreak(const TBreakId aBreakId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode)
  1.1832 +
  1.1833 +	{
  1.1834 +	TPckgBuf<TProcessId> processIdPckg(aProcessId);
  1.1835 +	TIpcArgs args(aBreakId,&processIdPckg,aAddress,aArchitectureMode);
  1.1836 +	return SendReceive(EDebugServModifyProcessBreak, args);
  1.1837 +	}
  1.1838 +
  1.1839 +/**
  1.1840 +Purpose:
  1.1841 +Returns the properties associated with a given TBreakId. The supplied break id must previously have been allocated
  1.1842 +to the debug agent by a SetBreak() call.
  1.1843 +
  1.1844 +@pre Debug Agent must be connected to the debug security server
  1.1845 +@pre Debug Agent must be attached to a process.
  1.1846 +@pre The aBreakId must have been previously returned by a SetBreak() call and not subsequently cleared by ClearBreak().
  1.1847 +
  1.1848 +@param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent.
  1.1849 +@param aAddress on return contains the virtual memory address of the breakpoint
  1.1850 +@param aThreadId on return contains the thread id of the thread that the breakpoint is set in
  1.1851 +@param aMode on return contains the type of this breakpoint (e.g. ARM/Thumb/Thumb2EE)
  1.1852 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1853 +*/
  1.1854 +inline TInt RSecuritySvrSession::BreakInfo(const TBreakId aBreakId, TThreadId& aThreadId, TUint32& aAddress, TArchitectureMode& aMode)
  1.1855 +	{
  1.1856 +	// temporary descriptors
  1.1857 +	TPtr8 threadId((TUint8*)&aThreadId,0,sizeof(TThreadId));
  1.1858 +	TPtr8 address((TUint8*)&aAddress,0,sizeof(TUint32));
  1.1859 +	TPtr8 mode((TUint8*)&aMode,0,sizeof(TArchitectureMode));
  1.1860 +
  1.1861 +	TIpcArgs args(aBreakId,&threadId,&address,&mode);
  1.1862 +	return SendReceive(EDebugServBreakInfo, args);
  1.1863 +	}
  1.1864 +
  1.1865 +/**
  1.1866 +Purpose:
  1.1867 +Set a process-specific breakpoint in an attached process. 
  1.1868 +
  1.1869 +@pre Debug Agent must be connected to the debug security server
  1.1870 +@pre Debug Agent must be attached to a process.
  1.1871 +
  1.1872 +@param aProcessId The process id to which the breakpoint will apply.
  1.1873 +@param aAddress The virtual memory address at which to place the breakpoint.
  1.1874 +@param aArchitectureMode The kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE)
  1.1875 +@param aBreakId The address to which the assigned breakpoint ID will be written by this function
  1.1876 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1877 +*/
  1.1878 +inline TInt RSecuritySvrSession::SetProcessBreak( TBreakId &aBreakId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode)
  1.1879 +	{
  1.1880 +	TPtr8 breakIdPtr((TUint8*)&aBreakId, sizeof(aBreakId));
  1.1881 +
  1.1882 +	TPckgBuf<TProcessId> threadIdPckg(aProcessId);
  1.1883 +
  1.1884 +	TBreakInfo breakInfo;
  1.1885 +	breakInfo.iAddress = aAddress;
  1.1886 +	breakInfo.iArchitectureMode = aArchitectureMode;
  1.1887 +	TPckgBuf<TBreakInfo> breakInfoPckg(breakInfo);
  1.1888 +
  1.1889 +	//call driver to attempt to set break
  1.1890 +	TIpcArgs args(&threadIdPckg, &breakInfoPckg, &breakIdPtr);
  1.1891 +	return SendReceive(EDebugServSetProcessBreak, args);
  1.1892 +	}
  1.1893 +
  1.1894 +/**
  1.1895 +Purpose:
  1.1896 +Returns the properties associated with a given TBreakId. The supplied break id must previously have been allocated
  1.1897 +to the debug agent by a SetProcessBreak() call.
  1.1898 +
  1.1899 +@pre Debug Agent must be connected to the debug security server
  1.1900 +@pre Debug Agent must be attached to a process.
  1.1901 +@pre The aBreakId must have been previously returned by a SetProcessBreak() call and not subsequently cleared by ClearBreak().
  1.1902 +
  1.1903 +@param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent.
  1.1904 +@param aAddress on return contains the virtual memory address of the breakpoint
  1.1905 +@param aThreadId on return contains the thread id of the thread that the breakpoint is set in
  1.1906 +@param aMode on return contains the type of this breakpoint (e.g. ARM/Thumb/Thumb2EE)
  1.1907 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1908 +*/
  1.1909 +inline TInt RSecuritySvrSession::ProcessBreakInfo(const TBreakId aBreakId, TProcessId& aProcessId, TUint32& aAddress, TArchitectureMode& aMode)
  1.1910 +	{
  1.1911 +	// temporary descriptors
  1.1912 +	TPtr8 processId((TUint8*)&aProcessId,0,sizeof(TProcessId));
  1.1913 +	TPtr8 address((TUint8*)&aAddress,0,sizeof(TUint32));
  1.1914 +	TPtr8 mode((TUint8*)&aMode,0,sizeof(TArchitectureMode));
  1.1915 +
  1.1916 +	TIpcArgs args(aBreakId,&processId,&address,&mode);
  1.1917 +	return SendReceive(EDebugServProcessBreakInfo, args);
  1.1918 +	}
  1.1919 +
  1.1920 +/**
  1.1921 +Purpose:
  1.1922 +Wait for an event to occur to the target executable being debugged. When an event
  1.1923 +occurs, the TRequestStatus is changed from KRequestPending.
  1.1924 +
  1.1925 +@pre Debug Agent must be connected to the debug security server
  1.1926 +@pre Debug Agent must be attached to a process.
  1.1927 +
  1.1928 +Note 1: Events are reported on a per-executable basis, not per-thread.
  1.1929 +
  1.1930 +Note 2: All the parameters must remain in scope until either CancelGetEvent is called, or
  1.1931 +until TRequestStatus is changed from KRequestPending. In practice, this generally
  1.1932 +means these parameters should not be based on the stack, as they may go out of
  1.1933 +scope before the call completes.
  1.1934 +
  1.1935 +Note 3: TIpcArgs args is allocated on the stack within this function, however,
  1.1936 +all the data containing in args is transferred in the SendReceive() so it can safely
  1.1937 +go out of scope after the call has been made.
  1.1938 +
  1.1939 +@param aExecutableName The name of any executable to which the Debug Agent is attached.
  1.1940 +@param aStatus Debug Agent request status variable.
  1.1941 +@param aEventInfo Descriptor containing a buffer sufficient for Event information.
  1.1942 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1943 +*/
  1.1944 +inline void RSecuritySvrSession::GetEvent(const TDesC& aExecutableName, TRequestStatus &aStatus, TDes8& aEventInfo)
  1.1945 +	{
  1.1946 +	TIpcArgs args(&aExecutableName, &aEventInfo);
  1.1947 +
  1.1948 +	SendReceive(EDebugServGetEvent, args, aStatus );
  1.1949 +
  1.1950 +	}
  1.1951 + 
  1.1952 +/**
  1.1953 +Purpose:
  1.1954 +Cancel a previously issued asynchronous RSecuritySvrSession::GetEvent call. The previously
  1.1955 +issued call will immediately complete with the TRequestStatus = KErrCancel
  1.1956 +
  1.1957 +@pre Debug Agent must be connected to the debug security server
  1.1958 +@pre Debug Agent must be attached to the process specified by aProcessName
  1.1959 +@pre Debug Agent must have previously issued an RSecuritySvrSession::GetEvent() call.
  1.1960 +
  1.1961 +@param aExecutableName The name of the executable being debugged.
  1.1962 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.1963 +*/
  1.1964 +inline TInt RSecuritySvrSession::CancelGetEvent(const TDesC& aExecutableName)
  1.1965 +{
  1.1966 +	TIpcArgs args(&aExecutableName);
  1.1967 +
  1.1968 +	return SendReceive(EDebugServCancelGetEvent,args);
  1.1969 +}
  1.1970 +
  1.1971 +/**
  1.1972 +Called by a debug agent to request debug privileges for the executable with
  1.1973 +file name aExecutableName.
  1.1974 +
  1.1975 +@param aExecutableName a fully qualified file name of the executable to attach to
  1.1976 +@param aPassive if true then the agent has reduced debug rights.
  1.1977 +
  1.1978 +@return KErrNone if attached successfully, one of the other system wide error
  1.1979 +	codes otherwise
  1.1980 +*/
  1.1981 +inline TInt RSecuritySvrSession::AttachExecutable(const TDesC& aExecutableName, TBool aPassive)
  1.1982 +	{
  1.1983 +	TIpcArgs args((TInt)aPassive, &aExecutableName);
  1.1984 +	return SendReceive(EDebugServAttachExecutable, args);
  1.1985 +	}
  1.1986 +
  1.1987 +/**
  1.1988 +Called by a debug agent to detach from the executable with file
  1.1989 +name aExecutableName.
  1.1990 +
  1.1991 +@param aExecutableName the fully qualified file name of the executable to detach from
  1.1992 +
  1.1993 +@return KErrNone if detached successfully, one of the other system wide error
  1.1994 +	codes otherwise
  1.1995 +*/
  1.1996 +inline TInt RSecuritySvrSession::DetachExecutable(const TDesC& aExecutableName)
  1.1997 +	{
  1.1998 +	TIpcArgs args(&aExecutableName);
  1.1999 +	return SendReceive(EDebugServDetachExecutable, args);
  1.2000 +	}
  1.2001 +
  1.2002 +/**
  1.2003 +Close the session and thread
  1.2004 +
  1.2005 +@return KErrNone if the session is closed successfully, otherwise one of the system wide errors.
  1.2006 +*/
  1.2007 +inline TInt RSecuritySvrSession::Close()
  1.2008 +	{
  1.2009 +	RSessionBase::Close();
  1.2010 +	return KErrNone;
  1.2011 +	}
  1.2012 +
  1.2013 +/**
  1.2014 +Get buffer size required to contain Functionality text block.
  1.2015 +
  1.2016 +@see in-source documentation in rm_debug_api.h
  1.2017 +
  1.2018 +@param aBufSize function will fill this with the required buffer size
  1.2019 +
  1.2020 +@return KErrNone if the call succeeded, or one of the other system wide error
  1.2021 +        codes if the call failed
  1.2022 +*/
  1.2023 +inline TInt RSecuritySvrSession::GetDebugFunctionalityBufSize(TUint32 *aBufSize)
  1.2024 +	{	
  1.2025 +	TInt res = KErrNone;
  1.2026 +
  1.2027 +	TPtr8 stuff((TUint8*)aBufSize,4, 4);
  1.2028 +
  1.2029 +	TIpcArgs args(&stuff);
  1.2030 +
  1.2031 +	res = SendReceive(EDebugServGetDebugFunctionalityBufSize, args);
  1.2032 +	
  1.2033 +	return res;
  1.2034 +	}
  1.2035 +
  1.2036 +/**
  1.2037 +Get debug functionality text block and place it into aBuffer.
  1.2038 +
  1.2039 +The debug functionality block (DFBlock) is used to provide information about the functionality
  1.2040 +(i.e. features) which are supported by the rm_debug.ldd device driver.
  1.2041 +
  1.2042 +Calling this function with a suitably sized buffer aBuffer will result in the debug
  1.2043 +functionality information being stored in aBuffer. The necessary size of aBuffer can
  1.2044 +be determined by calling DebugFunctionalityBufSize().
  1.2045 +
  1.2046 +The format of the DFBlock is:
  1.2047 +
  1.2048 +@code
  1.2049 +Sub-block 0
  1.2050 +Sub-block 1
  1.2051 +...
  1.2052 +Sub-block N-1
  1.2053 +@endcode
  1.2054 +
  1.2055 +The data which will be returned by a call to GetDebugFunctionality() is constant so is
  1.2056 +guaranteed to fit exactly into the aBuffer allocated, assuming that the size of aBuffer
  1.2057 +corresponds to the value returned from GetDebugFunctionalityBufSize().
  1.2058 +
  1.2059 +Each sub-block is composed of a TTagHeader object followed by a C-style array of TTag objects.
  1.2060 +The sub-block contains information about a particular aspect of the debug sub-system, for example
  1.2061 +information about the manner in which memory can be accessed.
  1.2062 +The TTagHeader is comprised of an identifier which determines the type of data
  1.2063 +it contains, together with the number of TTag elements in the array following the TTagHeader.
  1.2064 +Each TTag in a sub-block has a unique ID, stored in the TTag::iTagId member variable.
  1.2065 +
  1.2066 +The only sub-block that is guaranteed to exist has TTagHeader::iTagHdrId = ETagHeaderIdCore, all other
  1.2067 +sub-blocks are optional. The ETagHeaderIdCore sub-block is the first sub-block within the DFBlock.
  1.2068 +Other sub-blocks may appear in any order after the ETagHeaderIdCore sub-block.
  1.2069 +
  1.2070 +The following is a diagrammatic representation of a sub-block the DFBlock:
  1.2071 +
  1.2072 +@code
  1.2073 +The HHHH represents the tag header ID of a sub-block (TTagHeader::iTagHdrId)
  1.2074 +The NNNN represents the number of TTag elements in the sub-block (TTagHeader::iNumTags)
  1.2075 +The IIIIIIII represents the ID of the TTag (TTag::iTagId)
  1.2076 +The TTTT represents the type of the TTag (TTag::iType)
  1.2077 +The SSSS represents the size of the TTag's associated data (TTag::iSize)
  1.2078 +The VVVVVVVV represents the TTag's value (TTag::iValue)
  1.2079 +
  1.2080 +0xNNNNHHHH	TTagHeader element for first sub-block (has N1 TTag elements)
  1.2081 +0xIIIIIIII	\
  1.2082 +0xSSSSTTTT	-- TTag 0
  1.2083 +0xVVVVVVVV	/
  1.2084 +0xIIIIIIII	\
  1.2085 +0xSSSSTTTT	-- TTag 1
  1.2086 +0xVVVVVVVV	/
  1.2087 +...
  1.2088 +0xIIIIIIII	\
  1.2089 +0xSSSSTTTT	-- TTag N1 - 1
  1.2090 +0xVVVVVVVV	/
  1.2091 +0xNNNNHHHH	TTagHeader element for second sub-block (has N2 TTag elements)
  1.2092 +0xIIIIIIII	\
  1.2093 +0xSSSSTTTT	-- TTag 0
  1.2094 +0xVVVVVVVV	/
  1.2095 +...
  1.2096 +0xIIIIIIII	\
  1.2097 +0xSSSSTTTT	-- TTag N2 - 1
  1.2098 +0xVVVVVVVV	/
  1.2099 +...
  1.2100 +0xNNNNHHHH	TTagHeader element for last sub-block (has NX TTag elements)
  1.2101 +0xIIIIIIII	\
  1.2102 +0xSSSSTTTT	-- TTag 0
  1.2103 +0xVVVVVVVV	/
  1.2104 +...
  1.2105 +0xIIIIIIII	\
  1.2106 +0xSSSSTTTT	-- TTag NX - 1
  1.2107 +0xVVVVVVVV	/
  1.2108 +@endcode
  1.2109 +
  1.2110 +The following example DFBlock contains two sub-blocks (values taken from enums below):
  1.2111 +- ETagHeaderIdCore
  1.2112 +- ETagHeaderIdMemory
  1.2113 +
  1.2114 +@code
  1.2115 +Binary		Meaning					Value
  1.2116 +
  1.2117 +0x000A0000	iTagHdrId, iNumTags		ETagHeaderIdCore, ECoreLast
  1.2118 +0x00000000	iTagId					ECoreEvents
  1.2119 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2120 +0x00000001	iValue					ETrue
  1.2121 +0x00000001	iTagId					ECoreStartStop
  1.2122 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2123 +0x00000001	iValue					ETrue
  1.2124 +...
  1.2125 +0x00000008	iTagId					ECoreHardware
  1.2126 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2127 +0x00000000	iValue					EFalse
  1.2128 +0x00000009	iTagId					ECoreApiConstants
  1.2129 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2130 +0x00000001	iValue					ETrue
  1.2131 +
  1.2132 +0x000A0001	iTagHdrId, iNumTags		ETagHeaderIdMemory, EMemoryLast
  1.2133 +0x00000000	iTagId					EMemoryRead
  1.2134 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2135 +0x00000001	iValue					ETrue
  1.2136 +0x00000001	iTagId					EMemoryWrite
  1.2137 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2138 +0x00000001	iValue					ETrue
  1.2139 +...
  1.2140 +0x00000008	iTagId					EMemoryLE8
  1.2141 +0x00000000	iType, iSize			ETagTypeBoolean, 0
  1.2142 +0x00000001	iValue					ETrue
  1.2143 +0x00000009	iTagId					EMemoryMaxBlockSize
  1.2144 +0x00000001	iType, iSize			ETagTypeTUint32, 0
  1.2145 +0x00004000	iValue					0x4000
  1.2146 +@endcode
  1.2147 +
  1.2148 +- Debug Agent DFBlock Processing:
  1.2149 +
  1.2150 +Debug Agents MUST understand and process the ETagHeaderIdCore block. The other
  1.2151 +blocks may be ignored if not recognised. Tags within each block may be ignored if
  1.2152 +not recognised.
  1.2153 +
  1.2154 +@pre aBuffer.MaxLength() >= *aBufSize where aBufSize is set by a call to: 
  1.2155 +     RSecuritySvrSession::GetDebugFunctionalityBufSize(TUint32 *aBufSize)
  1.2156 +
  1.2157 +@param aBuffer buffer to store functionality block in
  1.2158 +
  1.2159 +@return KErrNone if call succeeded, 
  1.2160 +        KErrNoMemory if temporary memory could not be allocated, 
  1.2161 +        KErrGeneral if debug functionality block could not be accessed
  1.2162 +*/
  1.2163 +inline TInt RSecuritySvrSession::GetDebugFunctionality(TDes8& aBuffer)
  1.2164 +	{
  1.2165 +	TIpcArgs args(&aBuffer);
  1.2166 +
  1.2167 +	TInt res = KErrNone;
  1.2168 +
  1.2169 +	res = SendReceive(EDebugServGetDebugFunctionality, args);
  1.2170 +
  1.2171 +	return res;
  1.2172 +	}
  1.2173 +
  1.2174 +/**
  1.2175 +Read a block of memory from the target debug thread defined by aThreadId.
  1.2176 +
  1.2177 +@pre the client should attach to the process containing the target thread
  1.2178 +@pre aData.MaxLength() >= aLength
  1.2179 +
  1.2180 +@param aThreadId thread ID of the thread to read memory from
  1.2181 +@param aAddress address to start reading memory from
  1.2182 +@param aLength number of bytes of memory to read
  1.2183 +@param aData descriptor to read memory into
  1.2184 +@param aAccessSize access size for memory reads, default is TAccess::EAccess32
  1.2185 +@param aEndianess interpretation of endianess of target data, default is
  1.2186 +       TEndianess::EEndLE8
  1.2187 +
  1.2188 +@return KErrNone if memory read successfully, or one of the other system wide error codes
  1.2189 +*/
  1.2190 +inline TInt RSecuritySvrSession::ReadMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData, const TAccess aAccessSize, const TEndianess aEndianess)
  1.2191 +	{
  1.2192 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.2193 +	//set up memory info object
  1.2194 +	TMemoryInfo memoryInfo;
  1.2195 +	memoryInfo.iAddress = aAddress;
  1.2196 +	memoryInfo.iSize = aLength;
  1.2197 +	memoryInfo.iAccess = aAccessSize;
  1.2198 +	memoryInfo.iEndianess = aEndianess;
  1.2199 +
  1.2200 +	TPckgBuf<TMemoryInfo> pckg(memoryInfo);
  1.2201 +
  1.2202 +	TIpcArgs args(&threadIdPckg, &pckg, &aData);
  1.2203 +
  1.2204 +	return SendReceive(EDebugServReadMemory, args);
  1.2205 +	}
  1.2206 +
  1.2207 +/**
  1.2208 +Write a block of memory to the target debug thread defined by aThreadId.
  1.2209 +
  1.2210 +@pre the client should attach non-passively to the process containing the
  1.2211 +     target thread
  1.2212 +
  1.2213 +@param aThreadId thread ID of the thread to write memory to
  1.2214 +@param aAddress address to start writing memory at
  1.2215 +@param aLength number of bytes of memory to write
  1.2216 +@param aData descriptor to read memory from
  1.2217 +@param aAccessSize access size for memory writes, default is TAccess::EAccess32
  1.2218 +@param aEndianess interpretation of endianess of target data, default is
  1.2219 +       TEndianess::EEndLE8
  1.2220 +
  1.2221 +@return KErrNone if memory written successfully, or one of the other system wide error codes
  1.2222 +*/
  1.2223 +inline TInt RSecuritySvrSession::WriteMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData, const TAccess aAccessSize, const TEndianess aEndianess)
  1.2224 +	{
  1.2225 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.2226 +	//create memory info object
  1.2227 +	TMemoryInfo memoryInfo;
  1.2228 +	memoryInfo.iAddress = aAddress;
  1.2229 +	memoryInfo.iSize = aLength;
  1.2230 +	memoryInfo.iAccess = aAccessSize;
  1.2231 +	memoryInfo.iEndianess = aEndianess;
  1.2232 +
  1.2233 +	TPckgBuf<TMemoryInfo> pckg(memoryInfo);
  1.2234 +
  1.2235 +	TIpcArgs args(&threadIdPckg, &pckg, &aData);
  1.2236 +
  1.2237 +	return SendReceive(EDebugServWriteMemory, args);
  1.2238 +	}
  1.2239 +
  1.2240 +/**
  1.2241 +Read register values from the thread with thread ID aThreadId. The IDs of the
  1.2242 +registers to read are stored as an array of TRegisterInfo objects in 
  1.2243 +aRegisterIds. If the nth register requested could be read then the value of the 
  1.2244 +register will be appended to aRegisterValues and EValid stored at 
  1.2245 +offset n in aRegisterFlags. If the register is supported but could not be read 
  1.2246 +then EInValid will be stored at offset n in aRegisterFlags and arbitrary data 
  1.2247 +appended in aRegisterValues. If reading the specified register is not
  1.2248 +supported by the kernel then ENotSupported will be stored at offset n in 
  1.2249 +aRegisterFlags and arbitrary data appended to aRegisterValues. If an unknown
  1.2250 +register is specified then EUnknown will be put in aRegisterFlags and 
  1.2251 +arbitrary data placed in aRegisterValues.
  1.2252 +
  1.2253 +@pre the client should attach to the process containing the target thread
  1.2254 +
  1.2255 +@see the register ID format is defined in: 
  1.2256 +     SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc
  1.2257 +
  1.2258 +@param aThreadId thread ID of the thread to read register values from
  1.2259 +@param aRegisterIds descriptor containing array of TFunctionalityRegister defined 
  1.2260 +       register IDs
  1.2261 +@param aRegisterValues descriptor to contain register values
  1.2262 +@param aRegisterFlags descriptor containing array of TUint8 flags, with values 
  1.2263 +       taken from TRegisterFlag
  1.2264 +
  1.2265 +@return KErrNone if registers were read successfully, or one of the other system wide error codes
  1.2266 +*/
  1.2267 +inline TInt RSecuritySvrSession::ReadRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, TDes8& aRegisterValues, TDes8& aRegisterFlags)
  1.2268 +	{
  1.2269 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.2270 +	TIpcArgs args(&threadIdPckg, &aRegisterIds, &aRegisterValues, &aRegisterFlags);
  1.2271 +
  1.2272 +	return SendReceive(EDebugServReadRegisters, args);
  1.2273 +	}
  1.2274 +
  1.2275 +/**
  1.2276 +Write register values to the thread with thread ID aThreadId. The IDs of the 
  1.2277 +registers to write are stored as an array of TRegisterInfo objects in 
  1.2278 +aRegisterIds. The values to put in the registers are stored as an array of 
  1.2279 +objects in aRegisterValues. If the nth register to write could be 
  1.2280 +written then EValid stored at offset n in aRegisterFlags. If the register is 
  1.2281 +supported but could not be written then EInValid will be stored at offset n in 
  1.2282 +aRegisterFlags. If writing to the specified register is not supported by the 
  1.2283 +kernel then ENotSupported will be stored at offset n in aRegisterFlags. If an 
  1.2284 +unknown register is specified then EUnknown will be put in aRegisterFlags.
  1.2285 +
  1.2286 +@pre the client should attach non-passively to the process containing the 
  1.2287 +     target thread
  1.2288 +
  1.2289 +@see the register ID format is defined in: 
  1.2290 +     SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc
  1.2291 +
  1.2292 +@param aThreadId thread ID of the thread to write register values to
  1.2293 +@param aRegisterIds descriptor containing array of TFunctionalityRegister defined 
  1.2294 +       register IDs
  1.2295 +@param aRegisterValues descriptor containing array of register values
  1.2296 +@param aRegisterFlags descriptor containing array of TUint8 flags, with values 
  1.2297 +       taken from TRegisterFlag
  1.2298 +
  1.2299 +@return KErrNone if registers were written successfully, or one of the other system wide error codes
  1.2300 +*/
  1.2301 +inline TInt RSecuritySvrSession::WriteRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, const TDesC8& aRegisterValues, TDes8& aRegisterFlags)
  1.2302 +	{
  1.2303 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.2304 +	TIpcArgs args(&threadIdPckg, &aRegisterIds, &aRegisterValues, &aRegisterFlags);
  1.2305 +
  1.2306 +	return SendReceive(EDebugServWriteRegisters, args);
  1.2307 +	}
  1.2308 +
  1.2309 +/**
  1.2310 +Purpose:
  1.2311 +Set the requisite actions to be taken when a particular event occurs.
  1.2312 +The events are defined in Debug::TEventType and the
  1.2313 +actions are defined in Debug::TKernelEventAction.
  1.2314 +
  1.2315 +The default action for all events is EActionIgnore.
  1.2316 +
  1.2317 +@pre Debug Agent must be connected to the debug security server
  1.2318 +@pre Debug Agent must be attached to the executable specified by aExecutableName.
  1.2319 +
  1.2320 +Note: Event actions are on a per-executable basis. This is
  1.2321 +to ensure that events such as EEventStartThread are notified to the Debug
  1.2322 +Agent, even though the debug agent cannot be aware of the existence
  1.2323 +of a new thread at the time the event occurs.
  1.2324 +
  1.2325 +@param aExecutableName The name of the executable to which the Debug Agent is attached.
  1.2326 +@param aEvent A TEventType enum defined in rm_debug_api.h:Debug::TEventType
  1.2327 +@param aEventAction Any TKernelEventAction permitted by the DFBlock.
  1.2328 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2329 +*/
  1.2330 +inline TInt RSecuritySvrSession::SetEventAction(const TDesC& aExecutableName, TEventType aEvent, TKernelEventAction aEventAction)
  1.2331 +{
  1.2332 +	TInt res = KErrNone;
  1.2333 +
  1.2334 +	TIpcArgs args(&aExecutableName,aEvent,aEventAction);
  1.2335 +
  1.2336 +	res = SendReceive(EDebugServSetEventAction, args);
  1.2337 +	
  1.2338 +	return res;
  1.2339 +}
  1.2340 +
  1.2341 +/**
  1.2342 +Returns a global listing corresponding to the type specified as aListId. The structure
  1.2343 +of the returned data depends on the value of aListId, see TListId for details.
  1.2344 +If aListData is not large enough to contain the listings data then
  1.2345 +the necessary buffer size is stored in aDataSize and the function returns
  1.2346 +KErrTooBig. In this case the contents of aListData will not contain useful data.
  1.2347 +
  1.2348 +Note that if the aListData buffer was too small to hold the data then the value
  1.2349 +returned as aDataSize corresponds to the size of the data at that particular
  1.2350 +instance. The size of the data will vary over time, for example the thread list
  1.2351 +will increase and decrease in size as threads are created and destroyed, so
  1.2352 +re-requesting data with a buffer with max length aDataSize will not necessarily
  1.2353 +succeed if a list has increased in size between the two calls.
  1.2354 +
  1.2355 +@see TListId
  1.2356 +
  1.2357 +@param aListId enum from TListId signifying which type of listing to return
  1.2358 +@param aListData buffer provided by the debug agent in which data can be returned by the debug system
  1.2359 +@param aDataSize if aListData was not large enough to contain the requested
  1.2360 +       data then the necessary buffer size is stored in aDataSize. If aListData
  1.2361 +       was large enough then the value of aDataSize is the length of aListData
  1.2362 +
  1.2363 +@return KErrNone if data was returned successfully,
  1.2364 +        KErrTooBig if aListData is too small to hold the data,
  1.2365 +	one of the other system-wide error codes
  1.2366 +*/
  1.2367 +inline TInt RSecuritySvrSession::GetList(const TListId aListId, TDes8& aListData, TUint32& aDataSize)
  1.2368 +	{
  1.2369 +	//second argument of ETrue implies a global listing
  1.2370 +	TListDetails info(aListId, EScopeGlobal);
  1.2371 +	TPtr8 infoBuf((TUint8*)&info, sizeof(TListDetails), sizeof(TListDetails));
  1.2372 +	TPtr8 dataSizeBuf((TUint8*)&aDataSize, sizeof(TUint32), sizeof(TUint32));
  1.2373 +	TIpcArgs args(&infoBuf, &aListData, &dataSizeBuf);
  1.2374 +	return SendReceive(EDebugServGetList, args);
  1.2375 +	}
  1.2376 +
  1.2377 +/**
  1.2378 +Returns a thread-specific listing corresponding to the type specified as aListId. The structure
  1.2379 +of the returned data depends on the value of aListId, see TListId for details.
  1.2380 +If aListData is not large enough to contain the listings data then
  1.2381 +the necessary buffer size is stored in aDataSize and the function returns
  1.2382 +KErrTooBig. In this case the contents of aListData will not contain useful data.
  1.2383 +
  1.2384 +Note that if the aListData buffer is too small to hold the data then the value
  1.2385 +returned as aDataSize corresponds to the size of the data at that particular
  1.2386 +instant. The size of the data will vary over time, for example the thread list
  1.2387 +will increase and decrease in size as threads are created and destroyed, so
  1.2388 +re-requesting data with a buffer with max length aDataSize will not necessarily
  1.2389 +succeed if a list has increased in size between the two calls.
  1.2390 +
  1.2391 +@see TListId
  1.2392 +
  1.2393 +@param aThreadId thread to return the listing for
  1.2394 +@param aListId member of TListId signifying which type of listing to return
  1.2395 +@param aListData buffer provided by the debug agent in which data can be returned by the debug system.
  1.2396 +@param aDataSize if aListData was not large enough to contain the requested
  1.2397 +       data then the necessary buffer size is stored in aDataSize. If aListData
  1.2398 +       was large enough then the value of aDataSize is the length of aListData
  1.2399 +
  1.2400 +@return KErrNone if data was returned successfully,
  1.2401 +        KErrTooBig if aListData is too small to hold the data,
  1.2402 +	one of the other system-wide error codes
  1.2403 +*/
  1.2404 +inline TInt RSecuritySvrSession::GetList(const TThreadId aThreadId, const TListId aListId, TDes8& aListData, TUint32& aDataSize)
  1.2405 +	{
  1.2406 +	TListDetails info(aListId, EScopeThreadSpecific, aThreadId.Id());
  1.2407 +	TPtr8 infoBuf((TUint8*)&info, sizeof(TListDetails), sizeof(TListDetails));
  1.2408 +	TPtr8 dataSizeBuf((TUint8*)&aDataSize, sizeof(TUint32), sizeof(TUint32));
  1.2409 +	TIpcArgs args(&infoBuf, &aListData, &dataSizeBuf);
  1.2410 +	return SendReceive(EDebugServGetList, args);
  1.2411 +	}
  1.2412 +
  1.2413 +/**
  1.2414 +Returns a process-specific listing corresponding to the type specified as aListId. The structure
  1.2415 +of the returned data depends on the value of aListId, see TListId for details.
  1.2416 +If aListData is not large enough to contain the listings data then
  1.2417 +the necessary buffer size is stored in aDataSize and the function returns
  1.2418 +KErrTooBig. In this case the contents of aListData will not contain useful data.
  1.2419 +
  1.2420 +Note that if the aListData buffer is too small to hold the data then the value
  1.2421 +returned as aDataSize corresponds to the size of the data at that particular
  1.2422 +instant. The size of the data will vary over time, for example the thread list
  1.2423 +will increase and decrease in size as threads are created and destroyed, so
  1.2424 +re-requesting data with a buffer with max length aDataSize will not necessarily
  1.2425 +succeed if a list has increased in size between the two calls.
  1.2426 +
  1.2427 +@see TListId
  1.2428 +
  1.2429 +@param aProcessId process to return the listing for
  1.2430 +@param aListId member of TListId signifying which type of listing to return
  1.2431 +@param aListData buffer provided by the debug agent in which data can be returned by the debug system.
  1.2432 +@param aDataSize if aListData was not large enough to contain the requested
  1.2433 +       data then the necessary buffer size is stored in aDataSize. If aListData
  1.2434 +       was large enough then the value of aDataSize is the length of aListData
  1.2435 +
  1.2436 +@return KErrNone if data was returned successfully,
  1.2437 +        KErrTooBig if aListData is too small to hold the data,
  1.2438 +	one of the other system-wide error codes
  1.2439 +*/
  1.2440 +inline TInt RSecuritySvrSession::GetList(const TProcessId aProcessId, const TListId aListId, TDes8& aListData, TUint32& aDataSize)
  1.2441 +	{
  1.2442 +	TListDetails info(aListId, EScopeProcessSpecific, aProcessId.Id());
  1.2443 +	TPtr8 infoBuf((TUint8*)&info, sizeof(TListDetails), sizeof(TListDetails));
  1.2444 +	TPtr8 dataSizeBuf((TUint8*)&aDataSize, sizeof(TUint32), sizeof(TUint32));
  1.2445 +	TIpcArgs args(&infoBuf, &aListData, &dataSizeBuf);
  1.2446 +	return SendReceive(EDebugServGetList, args);
  1.2447 +	}
  1.2448 +
  1.2449 +/**
  1.2450 +Purpose:
  1.2451 +Step one or more CPU instructions in the specified thread from the current PC.
  1.2452 +
  1.2453 +@pre Debug Agent must be connected to the debug security server
  1.2454 +@pre Debug Agent must be attached to a process.
  1.2455 +@pre The thread being stepped must be suspended by the Debug Agent.
  1.2456 +
  1.2457 +@param aThreadId the id of the thread which is to be stepped
  1.2458 +@param aNumSteps how many machine-level instructions are to be stepped.
  1.2459 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2460 +*/
  1.2461 +inline TInt RSecuritySvrSession::Step(const TThreadId aThreadId, const TUint32 aNumSteps)
  1.2462 +	{
  1.2463 +	TPckgBuf<TThreadId> threadIdPckg(aThreadId);
  1.2464 +	TInt res = KErrNone;
  1.2465 +
  1.2466 +	TIpcArgs args(&threadIdPckg,aNumSteps);
  1.2467 +
  1.2468 +	res = SendReceive(EDebugServStep,args);
  1.2469 +
  1.2470 +	return res;
  1.2471 +	}
  1.2472 +
  1.2473 +/**
  1.2474 +Purpose:
  1.2475 +Kill the specified process with the supplied reason. Reason codes are equivalent
  1.2476 +to those in RProcess.Kill().
  1.2477 +
  1.2478 +@pre Debug Agent must be connected to the debug security server
  1.2479 +@pre Debug Agent must be attached to a process.
  1.2480 +
  1.2481 +@param aProcessId the id of the process which is to be killed
  1.2482 +@param aReason The reason to be associated with the ending of this process
  1.2483 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2484 +*/
  1.2485 +inline TInt RSecuritySvrSession::KillProcess(const TProcessId aProcessId, const TInt aReason)
  1.2486 +	{
  1.2487 +	TPckgBuf<TProcessId> processIdPckg(aProcessId);
  1.2488 +	TInt res = KErrNone;
  1.2489 +
  1.2490 +	TIpcArgs args(&processIdPckg,aReason);
  1.2491 +
  1.2492 +	res = SendReceive(EDebugServKillProcess,args);
  1.2493 +
  1.2494 +	return res;
  1.2495 +	}
  1.2496 +
  1.2497 +/**
  1.2498 +Purpose
  1.2499 +Method to read data from the crash flash
  1.2500 +
  1.2501 +@pre aData buffer to retrieve the data from the crash flash
  1.2502 +@pre aDataSize Size of the data
  1.2503 +
  1.2504 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2505 +*/
  1.2506 +inline TInt RSecuritySvrSession::ReadCrashLog(const TUint32 aPos, TDes8& aData, const TUint32 aDataSize)
  1.2507 +	{		
  1.2508 +		TIpcArgs args(aPos, &aData, aDataSize);		
  1.2509 +		TInt res = SendReceive(EDebugServReadCrashFlash,args);
  1.2510 +		return res;
  1.2511 +	}
  1.2512 +
  1.2513 +/**
  1.2514 + * @internalTechnology
  1.2515 + * @prototype
  1.2516 + * 
  1.2517 +Purpose:
  1.2518 +Method to write the crash flash config
  1.2519 +
  1.2520 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2521 +*/
  1.2522 +inline TInt RSecuritySvrSession::WriteCrashConfig(const TUint32 aPos, const TDesC8& aBuffer, TUint32& aSize)
  1.2523 +	{
  1.2524 +		TPtr8 sizePtr((TUint8*)&aSize,4, 4);
  1.2525 +		TIpcArgs args(aPos, &aBuffer, &sizePtr);
  1.2526 +		TInt res = SendReceive(EDebugServWriteCrashFlash, args);
  1.2527 +		return res;
  1.2528 +	}
  1.2529 +/**
  1.2530 +Purpose:
  1.2531 +Method to erase a block in the crash flash
  1.2532 +
  1.2533 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2534 +*/
  1.2535 +inline TInt RSecuritySvrSession::EraseCrashLog(const TUint32 aPos, const TUint32 aBlockNumber)
  1.2536 +	{	
  1.2537 +		TIpcArgs args(aPos, aBlockNumber);
  1.2538 +		TInt res = SendReceive(EDebugServEraseCrashFlash, args);
  1.2539 +		return res;
  1.2540 +	}
  1.2541 +
  1.2542 +/**
  1.2543 +Purpose:
  1.2544 +Method to erase entire flash partition
  1.2545 +
  1.2546 +@return Any error which may be returned by RSessionBase::SendReceive()
  1.2547 +*/
  1.2548 +inline TInt RSecuritySvrSession::EraseCrashFlashPartition()
  1.2549 +	{
  1.2550 +	TInt res = SendReceive(EDebugServEraseEntireCrashFlash);
  1.2551 +	return res;
  1.2552 +	}
  1.2553 +
  1.2554 +} // end of Debug namespace declaration
  1.2555 +
  1.2556 +#endif // #ifndef __KERNEL_MODE__
  1.2557 +
  1.2558 +#endif // RM_DEBUG_API_H
  1.2559 +
  1.2560 +
  1.2561 +