|
1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Definitions for the run mode debug agent client side sessions. |
|
15 // |
|
16 // WARNING: This file contains some APIs which are internal and are subject |
|
17 // to change without notice. Such APIs should therefore not be used |
|
18 // outside the Kernel and Hardware Services package. |
|
19 // |
|
20 |
|
21 #ifndef RM_DEBUG_API_H |
|
22 #define RM_DEBUG_API_H |
|
23 |
|
24 /** |
|
25 @file |
|
26 @publishedPartner |
|
27 @released |
|
28 */ |
|
29 |
|
30 #include <e32cmn.h> |
|
31 #include <e32def_private.h> |
|
32 |
|
33 /** |
|
34 The Debug namespace contains all API definitions used for on-target debugging. |
|
35 */ |
|
36 namespace Debug { |
|
37 |
|
38 /** This is the maximum size in bytes a user trace can be */ |
|
39 const TInt TUserTraceSize = 256; |
|
40 |
|
41 /** |
|
42 Information in the debug functionality block is represented as a concatenation |
|
43 of pairs of TTagHeader structures and arrays of TTag objects. |
|
44 @see TTagHeader |
|
45 @see RSecuritySvrSession::GetDebugFunctionality |
|
46 */ |
|
47 struct TTag |
|
48 { |
|
49 /** Tag ID, value identifying this tag. */ |
|
50 TUint32 iTagId; |
|
51 /** |
|
52 Values correspond to TTagType enumerators. |
|
53 @see TTagType |
|
54 */ |
|
55 TUint16 iType; |
|
56 /** Size of external data associated with this tag. */ |
|
57 TUint16 iSize; |
|
58 /** Data associated with this tag. */ |
|
59 TUint32 iValue; |
|
60 }; |
|
61 |
|
62 /** |
|
63 Enumeration defining the supported tag types. These enumerators are used in TTag.iTagId. |
|
64 @see TTag |
|
65 */ |
|
66 enum TTagType |
|
67 { |
|
68 /** Indicates that the iValue field of a TTag structure will contain either ETrue or EFalse. */ |
|
69 ETagTypeBoolean = 0, |
|
70 /** Indicates that the iValue field of a TTag structure will contain a value in the TUint32 range. */ |
|
71 ETagTypeTUint32 = 1, |
|
72 /** Indicates that the iValue field of a TTag structure will contain values from an enumeration. */ |
|
73 ETagTypeEnum = 2, |
|
74 /** Indicates that the iValue field of a TTag structure should be interpreted as a bit field. */ |
|
75 ETagTypeBitField = 3, |
|
76 /** Indicates that the type of the iValue field of a TTag structure is unknown. */ |
|
77 ETagTypeUnknown = 4, |
|
78 /** Indicates that the iValue field of a TTag structure will contain a pointer. */ |
|
79 ETagTypePointer = 5 |
|
80 }; |
|
81 |
|
82 /** |
|
83 Information in the debug functionality block is represented as a concatenation |
|
84 of pairs of TTagHeader structures and arrays of TTag objects. |
|
85 @see TTag |
|
86 @see RSecuritySvrSession::GetDebugFunctionality |
|
87 */ |
|
88 struct TTagHeader |
|
89 { |
|
90 /** Value identifying the contents of this TTagHeader, should be interpreted as an enumerator from TTagHeaderId. |
|
91 @see TTagHeaderId |
|
92 */ |
|
93 TUint16 iTagHdrId; |
|
94 /** The number of TTag elements in the array associated with this TTagHeader. */ |
|
95 TUint16 iNumTags; |
|
96 }; |
|
97 |
|
98 /** |
|
99 Enumeration used to identify TTagHeader structures, TTagHeader::iTagHdrId elements take these enumerators as values. |
|
100 @see TTagHeader |
|
101 */ |
|
102 enum TTagHeaderId |
|
103 { |
|
104 ETagHeaderIdCore = 0, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityCore. */ |
|
105 ETagHeaderIdMemory = 1, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityMemory. */ |
|
106 /** |
|
107 Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityRegister. |
|
108 These values are defined as in the document Symbian Core Dump File Format Appendix C |
|
109 (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc). |
|
110 The TTag objects in the associated array have an iSize value corresponding to the size of the register's data in bytes. |
|
111 */ |
|
112 ETagHeaderIdRegistersCore = 2, |
|
113 /** |
|
114 Identifies a TTagHeader with associated TTag elements with iTagId values corresponding to coprocessor register identifiers. |
|
115 Coprocessor registers are defined as in the document Symbian Core Dump File Format Appendix C as follows |
|
116 (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc): |
|
117 |
|
118 For each 32-bit data word defining a co-pro register, the definition of the meaning of the bits follows |
|
119 the ARM Architecture Reference manual instruction coding |
|
120 |
|
121 Upper Halfword Lower Halfword |
|
122 Opcode 2 CRm |
|
123 |
|
124 For example: The Domain Access Control Register is Register 3 of co-processor 15. The encoding is therefore |
|
125 CRm = 3 |
|
126 Opcode2 = 0 |
|
127 |
|
128 Therefore the functionality tag would be: |
|
129 TagID: 15 // co-processor number |
|
130 Type: ETagTypeTUint32 |
|
131 Data: 0x00000003 // Opcode2 = 0, CRm = 3 |
|
132 */ |
|
133 ETagHeaderIdCoProRegisters = 3, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityRegister. */ |
|
134 ETagHeaderIdBreakpoints = 4, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityBreakpoint. */ |
|
135 ETagHeaderIdStepping = 5, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityStep. */ |
|
136 ETagHeaderIdExecution = 6, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityExec. */ |
|
137 ETagHeaderIdEvents = 7, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TEventType. */ |
|
138 ETagHeaderIdApiConstants = 8, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityApiConstants.*/ |
|
139 ETagHeaderList = 9, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TListId. */ |
|
140 ETagHeaderIdKillObjects = 10, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityKillObject. */ |
|
141 ETagHeaderIdSecurity = 11, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalitySecurity */ |
|
142 ETagHeaderIdBuffers = 12, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TBufferType. */ |
|
143 ETagHeaderIdStopModeFunctions = 13, /**< Identifies a TTagHeader with associated TTag elements with iTagId values from TFunctionalityStopModeFunctions. */ |
|
144 }; |
|
145 |
|
146 /** |
|
147 This structure is not used in the run-mode debug API. |
|
148 @deprecated |
|
149 */ |
|
150 struct TSubBlock |
|
151 { |
|
152 /** Header to identify the TSubBlock. */ |
|
153 TTagHeader iHeader; |
|
154 /** Pointer to array of TTag values associated with this TSubBlock. */ |
|
155 TTag* iTagArray; |
|
156 }; |
|
157 |
|
158 /** |
|
159 These tags define what kinds of core functionality are supported by the run-mode debug subsystem. |
|
160 TTag structures associated with the ETagHeaderIdCore sub-block will have iTagId values from this enumeration. |
|
161 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
162 */ |
|
163 enum TFunctionalityCore |
|
164 { |
|
165 ECoreEvents = 0, /**< Indicates whether events processing is supported. */ |
|
166 ECoreStartStop = 1, /**< Indicates whether suspending and resuming threads is supported. */ |
|
167 ECoreMemory = 2, /**< Indicates whether reading and writing memory is supported. */ |
|
168 ECoreRegister = 3, /**< Indicates whether reading and writing register values is supported. */ |
|
169 ECoreBreakpoint = 4, /**< Indicates whether breakpoints are supported. */ |
|
170 ECoreStepping = 5, /**< Indicates whether stepping is supported. */ |
|
171 ECoreLists = 6, /**< Indicates whether listings are supported. */ |
|
172 ECoreLogging = 7, /**< Indicates whether logging is supported. */ |
|
173 ECoreHardware = 8, /**< Indicates whether hardware support is supported. */ |
|
174 ECoreApiConstants = 9, /**< Indicates whether the information in the ETagHeaderIdApiConstants sub-block is relevant. */ |
|
175 ECoreKillObjects = 10, /**< Indicates whether killing objects (i.e. threads and processes) is supported. */ |
|
176 ECoreSecurity = 11, /**< Indicates whether OEM Debug token support or other security info is supported. */ |
|
177 ECoreStopModeFunctions = 12, /**< Indicates whether Stop Mode function calling is supported. */ |
|
178 ECoreStopModeBuffers = 13, /**< Indicates whether Stop Mode buffers are supported. */ |
|
179 |
|
180 /** |
|
181 @internalTechnology |
|
182 A debug agent should find the number of core tags from the DFBlock rather than this enumerator. |
|
183 */ |
|
184 ECoreLast |
|
185 }; |
|
186 |
|
187 /** |
|
188 These tags define what kind of memory operations can be performed. |
|
189 TTag structures associated with the ETagHeaderIdMemory sub-block will have iTagId values from this enumeration. |
|
190 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
191 */ |
|
192 enum TFunctionalityMemory |
|
193 { |
|
194 EMemoryRead = 0, /**< Indicates whether reading memory is supported. */ |
|
195 EMemoryWrite = 1, /**< Indicates whether writing memory is supported. */ |
|
196 EMemoryAccess64 = 2, /**< Indicates whether 64 bit memory access is supported. */ |
|
197 EMemoryAccess32 = 3, /**< Indicates whether 32 bit memory access is supported. */ |
|
198 EMemoryAccess16 = 4, /**< Indicates whether 16 bit memory access is supported. */ |
|
199 EMemoryAccess8 = 5, /**< Indicates whether 8 bit memory access is supported. */ |
|
200 EMemoryBE8 = 6, /**< Indicates whether reading memory as 8 bit big-endian values is supported. */ |
|
201 EMemoryBE32 = 7, /**< Indicates whether reading memory as 32 bit big-endian values is supported. */ |
|
202 EMemoryLE8 = 8, /**< Indicates whether reading memory as 8 bit little-endian values is supported. */ |
|
203 EMemoryMaxBlockSize = 9, /**< Corresponds to the maximum size of a block of memory which can be requested. */ |
|
204 /** |
|
205 @internalTechnology |
|
206 A debug agent should find the number of memory tags from the DFBlock rather than this enumerator. |
|
207 */ |
|
208 EMemoryLast |
|
209 }; |
|
210 |
|
211 /** |
|
212 These tags define which objects can be killed by the device driver. |
|
213 TTag structures associated with the ETagHeaderIdKillObjects sub-block will have iTagId values from this enumeration. |
|
214 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
215 */ |
|
216 enum TFunctionalityKillObject |
|
217 { |
|
218 EFunctionalityKillThread = 0, /**< Indicates whether killing threads is supported. */ |
|
219 EFunctionalityKillProcess = 1, /**< Indicates whether killing processes is supported. */ |
|
220 /** |
|
221 @internalTechnology |
|
222 A debug agent should find the number of kill object tags from the DFBlock rather than this enumerator. |
|
223 */ |
|
224 EFunctionalityKillObjectLast |
|
225 }; |
|
226 |
|
227 /** |
|
228 A TTag with an id from the TFunctionalityRegister enum will have a value from this enumeration. |
|
229 The values define how a register can be accessed, if at all. |
|
230 */ |
|
231 enum TFunctionalityAccess |
|
232 { |
|
233 EAccessNone = 0, /**< Indicates that a register cannot be accessed. */ |
|
234 EAccessReadOnly = 1, /**< Indicates that a register can be read, but not written to. */ |
|
235 EAccessWriteOnly = 2, /**< Indicates that a register can be written to, but not read. */ |
|
236 EAccessReadWrite = 3, /**< Indicates that a register can be both read and written to. */ |
|
237 EAccessUnknown = 4, /**< Indicates that it is unspecified whether reading or writing to a register is possible. */ |
|
238 }; |
|
239 |
|
240 /** |
|
241 These enumerators act as core register identifiers. |
|
242 TTag structures associated with the ETagHeaderIdRegistersCore sub-block will have iTagId values from this enumeration. |
|
243 The numeric value of each enumerator identifies the register according to the definitions in the Symbian Core Dump File Format Appendix B |
|
244 (see SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc). |
|
245 */ |
|
246 enum TFunctionalityRegister |
|
247 { |
|
248 ERegisterR0 = 0x00000000, /**< Identifier for user mode register R0. */ |
|
249 ERegisterR1 = 0x00000100, /**< Identifier for user mode register R1. */ |
|
250 ERegisterR2 = 0x00000200, /**< Identifier for user mode register R2. */ |
|
251 ERegisterR3 = 0x00000300, /**< Identifier for user mode register R3. */ |
|
252 ERegisterR4 = 0x00000400, /**< Identifier for user mode register R4. */ |
|
253 ERegisterR5 = 0x00000500, /**< Identifier for user mode register R5. */ |
|
254 ERegisterR6 = 0x00000600, /**< Identifier for user mode register R6. */ |
|
255 ERegisterR7 = 0x00000700, /**< Identifier for user mode register R7. */ |
|
256 ERegisterR8 = 0x00000800, /**< Identifier for user mode register R8. */ |
|
257 ERegisterR9 = 0x00000900, /**< Identifier for user mode register R9. */ |
|
258 ERegisterR10 = 0x00000a00, /**< Identifier for user mode register R10. */ |
|
259 ERegisterR11 = 0x00000b00, /**< Identifier for user mode register R11. */ |
|
260 ERegisterR12 = 0x00000c00, /**< Identifier for user mode register R12. */ |
|
261 ERegisterR13 = 0x00000d00, /**< Identifier for user mode register R13. */ |
|
262 ERegisterR14 = 0x00000e00, /**< Identifier for user mode register R14. */ |
|
263 ERegisterR15 = 0x00000f00, /**< Identifier for user mode register R15. */ |
|
264 ERegisterCpsr = 0x00001000, /**< Identifier for CPSR. */ |
|
265 ERegisterR13Svc = 0x00001100, /**< Identifier for R13 supervisor mode banked register. */ |
|
266 ERegisterR14Svc = 0x00001200, /**< Identifier for R14 supervisor mode banked register. */ |
|
267 ERegisterSpsrSvc = 0x00001300, /**< Identifier for SPSR supervisor mode banked register. */ |
|
268 ERegisterR13Abt = 0x00001400, /**< Identifier for R13 Abort mode banked register. */ |
|
269 ERegisterR14Abt = 0x00001500, /**< Identifier for R14 Abort mode banked register. */ |
|
270 ERegisterSpsrAbt = 0x00001600, /**< Identifier for SPSR Abort mode banked register. */ |
|
271 ERegisterR13Und = 0x00001700, /**< Identifier for R13 Undefined mode banked register. */ |
|
272 ERegisterR14Und = 0x00001800, /**< Identifier for R14 Undefined mode banked register. */ |
|
273 ERegisterSpsrUnd = 0x00001900, /**< Identifier for SPSR Undefined mode banked register. */ |
|
274 ERegisterR13Irq = 0x00001a00, /**< Identifier for R13 Interrupt mode banked register. */ |
|
275 ERegisterR14Irq = 0x00001b00, /**< Identifier for R14 Interrupt mode banked register. */ |
|
276 ERegisterSpsrIrq = 0x00001c00, /**< Identifier for SPSR Interrupt mode banked register. */ |
|
277 ERegisterR8Fiq = 0x00001d00, /**< Identifier for R8 Fast Interrupt mode banked register. */ |
|
278 ERegisterR9Fiq = 0x00001e00, /**< Identifier for R9 Fast Interrupt mode banked register. */ |
|
279 ERegisterR10Fiq = 0x00001f00, /**< Identifier for R10 Fast Interrupt mode banked register. */ |
|
280 ERegisterR11Fiq = 0x00002000, /**< Identifier for R11 Fast Interrupt mode banked register. */ |
|
281 ERegisterR12Fiq = 0x00002100, /**< Identifier for R12 Fast Interrupt mode banked register. */ |
|
282 ERegisterR13Fiq = 0x00002200, /**< Identifier for R13 Fast Interrupt mode banked register. */ |
|
283 ERegisterR14Fiq = 0x00002300, /**< Identifier for R14 Fast Interrupt mode banked register. */ |
|
284 ERegisterSpsrFiq = 0x00002400, /**< Identifier for SPSR Fast Interrupt mode banked register. */ |
|
285 /** |
|
286 @internalTechnology |
|
287 A debug agent should find the number of core registers from the DFBlock rather than this enumerator. |
|
288 */ |
|
289 ERegisterLast = 37 |
|
290 }; |
|
291 |
|
292 |
|
293 /** |
|
294 These tags define the kind of breakpoints that are supported. |
|
295 TTag structures associated with the ETagHeaderIdBreakpoints sub-block will have iTagId values from this enumeration. |
|
296 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
297 */ |
|
298 enum TFunctionalityBreakpoint |
|
299 { |
|
300 EBreakpointThread = 0, /**< Indicates whether thread specific breakpoints are supported. */ |
|
301 EBreakpointProcess = 1, /**< Indicates whether process specific breakpoints are supported. */ |
|
302 EBreakpointSystem = 2, /**< Indicates whether system wide breakpoints are supported. */ |
|
303 EBreakpointArm = 3, /**< Indicates whether ARM mode breakpoints are supported. */ |
|
304 EBreakpointThumb = 4, /**< Indicates whether Thumb mode breakpoints are supported. */ |
|
305 EBreakpointT2EE = 5, /**< Indicates whether Thumb2 mode breakpoints are supported. */ |
|
306 EBreakpointArmInst = 6, /**< Reserved for future use. */ |
|
307 EBreakpointThumbInst = 7, /**< Reserved for future use. */ |
|
308 EBreakpointT2EEInst = 8, /**< Reserved for future use. */ |
|
309 EBreakpointSetArmInst = 9, /**< Reserved for future use. */ |
|
310 EBreakpointSetThumbInst = 10, /**< Reserved for future use. */ |
|
311 EBreakpointSetT2EEInst = 11, /**< Reserved for future use. */ |
|
312 /** |
|
313 @internalTechnology |
|
314 A debug agent should find the number of breakpoint tags from the DFBlock rather than this enumerator. |
|
315 */ |
|
316 EBreakpointLast |
|
317 }; |
|
318 |
|
319 /** |
|
320 These enumerators provide information about the stepping capabilities of the debug sub-system. |
|
321 TTag structures associated with the ETagHeaderIdStepping sub-block will have iTagId values from this enumeration. |
|
322 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
323 */ |
|
324 enum TFunctionalityStep |
|
325 { |
|
326 EStep = 0, /**< Indicates whether instruction stepping is supported. */ |
|
327 /** |
|
328 @internalTechnology |
|
329 A debug agent should find the number of stepping tags from the DFBlock rather than this enumerator. |
|
330 */ |
|
331 EStepLast |
|
332 }; |
|
333 |
|
334 /** |
|
335 These enumerators provide information about the execution control capabilities of the debug sub-system. |
|
336 TTag structures associated with the ETagHeaderIdExecution sub-block will have iTagId values from this enumeration. |
|
337 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
338 */ |
|
339 enum TFunctionalityExec |
|
340 { |
|
341 EExecThreadSuspendResume = 0, /**< Indicates whether suspending and resuming threads is supported. */ |
|
342 EExecProcessSuspendResume = 1, /**< Indicates whether suspending and resuming processes is supported. */ |
|
343 EExecSystemSuspendResume = 2, /**< Indicates whether suspending and resuming the entire system is supported. */ |
|
344 /** |
|
345 @internalTechnology |
|
346 A debug agent should find the number of execution control tags from the DFBlock rather than this enumerator. |
|
347 */ |
|
348 EExecLast |
|
349 }; |
|
350 |
|
351 /** |
|
352 This enumeration defines the event types supported by the debug sub-system. |
|
353 TTag structures associated with the ETagHeaderIdEvents sub-block will have |
|
354 iTagId values from this enumeration, and iValue values from the TKernelEventAction enumeration. |
|
355 |
|
356 These enumerators are also used by the RSecuritySvrSession API to identify events. |
|
357 @see RSecuritySvrSession |
|
358 @see TKernelEventAction |
|
359 */ |
|
360 enum TEventType |
|
361 { |
|
362 EEventsBreakPoint = 0, /**< Identifies a breakpoint event. */ |
|
363 EEventsSwExc = 1, /**< Identifies a software exception event. */ |
|
364 EEventsHwExc = 2, /**< Identifies a hardware exception event. */ |
|
365 EEventsKillThread = 3, /**< Identifies a kill thread event. */ |
|
366 EEventsAddLibrary = 4, /**< Identifies an add library event. */ |
|
367 EEventsRemoveLibrary = 5, /**< Identifies a remove library event. */ |
|
368 /** |
|
369 If an event is generated and there is only a single space remaining in the events queue then |
|
370 an event of type EEventsBufferFull will be stored in the queue and the generated event will |
|
371 be discarded. If further events occur while the buffer is full the events will be discarded. |
|
372 As such an event of type EEventsBufferFull being returned signifies that one or more events |
|
373 were discarded. An event of this type has no valid data associated with it. |
|
374 */ |
|
375 EEventsBufferFull = 6, |
|
376 EEventsUnknown = 7, /**< Identifies an event of unknown type. */ |
|
377 EEventsUserTrace = 8, /**< Identifies a user trace. */ |
|
378 EEventsProcessBreakPoint = 9, /**< Identifies a process breakpoint event. */ |
|
379 EEventsStartThread = 10, /**< Identifies a start thread event. */ |
|
380 EEventsUserTracesLost = 11, /**< Identifies user traces being lost. */ |
|
381 EEventsAddProcess = 12, /**< Identifies an AddProcess event */ |
|
382 EEventsRemoveProcess = 13, /**< Identifies a RemoveProcess event */ |
|
383 /** |
|
384 @internalTechnology |
|
385 A debug agent should find the number of event types from the DFBlock rather than this enumerator. |
|
386 */ |
|
387 EEventsLast |
|
388 }; |
|
389 |
|
390 /** |
|
391 These enumerators provide information about constants which are used in the RSecuritySvrSession API. |
|
392 TTag structures associated with the ETagHeaderIdApiConstants sub-block will have iTagId values from this enumeration. |
|
393 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
394 */ |
|
395 enum TFunctionalityApiConstants |
|
396 { |
|
397 /** |
|
398 Corresponds to the size of a buffer required to store a TEventInfo. |
|
399 @see TEventInfo |
|
400 */ |
|
401 EApiConstantsTEventInfoSize = 0, |
|
402 /** |
|
403 @internalTechnology |
|
404 A debug agent should find the number of API constants tags from the DFBlock rather than this enumerator. |
|
405 */ |
|
406 EApiConstantsLast, |
|
407 }; |
|
408 |
|
409 /** |
|
410 The set of possible actions which could be taken when a kernel event occurs. |
|
411 Not all actions are possible for all events. The debug functionality sub-block with header id ETagHeaderIdEvents |
|
412 indicates which values are permitted for each event. The value given for that event should be |
|
413 considered as the most intrusive action the debugger may set: with the definition that EActionSuspend is more |
|
414 intrusive than EActionContinue, which is more intrusive than EActionIgnore. |
|
415 @see RSecuritySvrSession |
|
416 */ |
|
417 enum TKernelEventAction |
|
418 { |
|
419 /** If an event action is set to this value then events of that type will be |
|
420 ignored, and not reported to the debugger. */ |
|
421 EActionIgnore = 0, |
|
422 /** If an event action is set to this value then events of that type will be |
|
423 reported to the debugger and the thread which generated the event will be |
|
424 allowed to continue executing. */ |
|
425 EActionContinue = 1, |
|
426 /** If an event action is set to this value then events of that type will be |
|
427 reported to the debugger and the thread which generated the event will be |
|
428 suspended. */ |
|
429 EActionSuspend = 2, |
|
430 /** |
|
431 @internalTechnology |
|
432 Count of event actions. |
|
433 */ |
|
434 EActionLast |
|
435 }; |
|
436 |
|
437 /** |
|
438 These enumerators provide information about the ability of the debug subsystem to support OEM Debug tokens. |
|
439 TTag structures associated with the ETagHeaderIdSecurity sub-block will have iTagId values from this enumeration. |
|
440 See each enumerator for an explanation of how a TTag with that iTagId should be interpreted. |
|
441 */ |
|
442 enum TFunctionalitySecurity |
|
443 { |
|
444 ESecurityOEMDebugToken = 0, /**< Indicates whether the DSS supports the use of OEM Debug Tokens. */ |
|
445 |
|
446 /** |
|
447 @internalTechnology |
|
448 A debug agent should find the number of tags from the DFBlock rather than this enumerator. |
|
449 */ |
|
450 ESecurityLast |
|
451 }; |
|
452 |
|
453 /** |
|
454 Used for storing the contents of a 32 bit register |
|
455 */ |
|
456 typedef TUint32 TRegisterValue32; |
|
457 |
|
458 |
|
459 /** |
|
460 * Processor mode |
|
461 */ |
|
462 enum TArmProcessorModes |
|
463 { |
|
464 EUserMode=0x10, //!< EUserMode |
|
465 EFiqMode=0x11, //!< EFiqMode |
|
466 EIrqMode=0x12, //!< EIrqMode |
|
467 ESvcMode=0x13, //!< ESvcMode |
|
468 EAbortMode=0x17, //!< EAbortMode |
|
469 EUndefMode=0x1b, //!< EUndefMode |
|
470 EMaskMode=0x1f //!< EMaskMode |
|
471 }; |
|
472 |
|
473 |
|
474 |
|
475 /** |
|
476 Structure containing information about the state of the registers when a |
|
477 hardware exception occurred |
|
478 */ |
|
479 class TRmdArmExcInfo |
|
480 { |
|
481 public: |
|
482 /** Enumeration detailing the types of exception which may occur. */ |
|
483 enum TExceptionType |
|
484 { |
|
485 /** Enumerator signifying that a prefetch abort error has occurred. */ |
|
486 EPrefetchAbort = 0, |
|
487 /** Enumerator signifying that a data abort error has occurred. */ |
|
488 EDataAbort = 1, |
|
489 /** Enumerator signifying that an undefined instruction error has occurred. */ |
|
490 EUndef =2 |
|
491 }; |
|
492 |
|
493 /** Value of CPSR. */ |
|
494 TRegisterValue32 iCpsr; |
|
495 /** Type of exception which has occurred. */ |
|
496 TExceptionType iExcCode; |
|
497 /** Value of R13 supervisor mode banked register. */ |
|
498 TRegisterValue32 iR13Svc; |
|
499 /** Value of user mode register R4. */ |
|
500 TRegisterValue32 iR4; |
|
501 /** Value of user mode register R5. */ |
|
502 TRegisterValue32 iR5; |
|
503 /** Value of user mode register R6. */ |
|
504 TRegisterValue32 iR6; |
|
505 /** Value of user mode register R7. */ |
|
506 TRegisterValue32 iR7; |
|
507 /** Value of user mode register R8. */ |
|
508 TRegisterValue32 iR8; |
|
509 /** Value of user mode register R9. */ |
|
510 TRegisterValue32 iR9; |
|
511 /** Value of user mode register R10. */ |
|
512 TRegisterValue32 iR10; |
|
513 /** Value of user mode register R11. */ |
|
514 TRegisterValue32 iR11; |
|
515 /** Value of R14 supervisor mode banked register. */ |
|
516 TRegisterValue32 iR14Svc; |
|
517 /** Address which caused exception (System Control Coprocessor Fault Address Register) */ |
|
518 TRegisterValue32 iFaultAddress; |
|
519 /** Value of System Control Coprocessor Fault Status Register. */ |
|
520 TRegisterValue32 iFaultStatus; |
|
521 /** Value of SPSR supervisor mode banked register. */ |
|
522 TRegisterValue32 iSpsrSvc; |
|
523 /** Value of user mode register R13. */ |
|
524 TRegisterValue32 iR13; |
|
525 /** Value of user mode register R14. */ |
|
526 TRegisterValue32 iR14; |
|
527 /** Value of user mode register R0. */ |
|
528 TRegisterValue32 iR0; |
|
529 /** Value of user mode register R1. */ |
|
530 TRegisterValue32 iR1; |
|
531 /** Value of user mode register R2. */ |
|
532 TRegisterValue32 iR2; |
|
533 /** Value of user mode register R3. */ |
|
534 TRegisterValue32 iR3; |
|
535 /** Value of user mode register R12. */ |
|
536 TRegisterValue32 iR12; |
|
537 /** Value of user mode register R15, points to instruction which caused exception. */ |
|
538 TRegisterValue32 iR15; |
|
539 }; |
|
540 |
|
541 /** |
|
542 The maximum size, in bytes, of the panic category string returned as part of a |
|
543 TEventInfo object. |
|
544 |
|
545 @see TEventInfo |
|
546 @see TThreadKillInfo |
|
547 */ |
|
548 const TInt KPanicCategoryMaxName = KMaxName; |
|
549 |
|
550 /** |
|
551 Event specific information returned as part of a TEventInfo object when |
|
552 an agent set breakpoint is hit. |
|
553 */ |
|
554 class TThreadBreakPointInfo |
|
555 { |
|
556 public: |
|
557 /** Identifies the type of exception. */ |
|
558 TExcType iExceptionNumber; |
|
559 /** Structure containing information about the ARM register values. */ |
|
560 TRmdArmExcInfo iRmdArmExcInfo; |
|
561 }; |
|
562 |
|
563 /** |
|
564 Event specific information returned as part of a TEventInfo object when |
|
565 a software exception occurs. |
|
566 */ |
|
567 class TThreadSwExceptionInfo |
|
568 { |
|
569 public: |
|
570 /** The value of the program counter. */ |
|
571 TUint32 iCurrentPC; |
|
572 /** Identifies the type of exception. */ |
|
573 TExcType iExceptionNumber; |
|
574 }; |
|
575 |
|
576 /** |
|
577 Event specific information returned as part of a TEventInfo object when |
|
578 a hardware exception occurs. |
|
579 */ |
|
580 class TThreadHwExceptionInfo |
|
581 { |
|
582 public: |
|
583 /** Identifies the type of exception. */ |
|
584 TExcType iExceptionNumber; |
|
585 /** Structure containing information about the ARM register values. */ |
|
586 TRmdArmExcInfo iRmdArmExcInfo; |
|
587 }; |
|
588 |
|
589 /** |
|
590 Event specific information returned as part of a TEventInfo object when |
|
591 a thread kill event occurs. |
|
592 */ |
|
593 class TThreadKillInfo |
|
594 { |
|
595 public: |
|
596 /** The value of the program counter. */ |
|
597 TUint32 iCurrentPC; |
|
598 /** 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. */ |
|
599 TInt iExitReason; |
|
600 /** Specifies the type of the thread kill event, values correspond to elements of TExitType. */ |
|
601 TUint8 iExitType; |
|
602 /** The panic category of the killed thread. */ |
|
603 TUint8 iPanicCategory[KPanicCategoryMaxName]; |
|
604 /** Contains the length in bytes of the initialised data in iPanicCategory. */ |
|
605 TInt iPanicCategoryLength; |
|
606 }; |
|
607 |
|
608 /** |
|
609 Event specific information returned as part of a TEventInfo object when |
|
610 a library load event occurs. |
|
611 */ |
|
612 class TLibraryLoadedInfo |
|
613 { |
|
614 public: |
|
615 /** The name of the file that the library was loaded from. */ |
|
616 TUint8 iFileName[KMaxName]; |
|
617 /** Contains the length in bytes of the initialised data in iFileName. */ |
|
618 TInt iFileNameLength; |
|
619 /** The code base address (.text). */ |
|
620 TUint32 iCodeAddress; |
|
621 /** The base address of the initialised data section (.data). */ |
|
622 TUint32 iDataAddress; |
|
623 }; |
|
624 |
|
625 /** |
|
626 Event specific information returned as part of a TEventInfo object when |
|
627 a thread is started |
|
628 */ |
|
629 class TStartThreadInfo |
|
630 { |
|
631 public: |
|
632 /** The name of the file that the process owning the thread was created from. */ |
|
633 TUint8 iFileName[KMaxName]; |
|
634 /** Contains the length in bytes of the initialised data in iFileName. */ |
|
635 TInt iFileNameLength; |
|
636 }; |
|
637 |
|
638 /** |
|
639 Event specific information returned as part of a TEventInfo object when |
|
640 a process is added. Note that the Process may not be fully constructed, |
|
641 e.g. no threads. |
|
642 */ |
|
643 class TAddProcessInfo |
|
644 { |
|
645 public: |
|
646 /** The name of the file that the process was created from. */ |
|
647 TUint8 iFileName[KMaxName]; |
|
648 /** Contains the length in bytes of the initialised data in iFileName. */ |
|
649 TInt iFileNameLength; |
|
650 /** The UID3 of this process */ |
|
651 TUint32 iUid3; |
|
652 /** Contains the CreatorThread ID if available: May be 0 */ |
|
653 TUint64 iCreatorThreadId; |
|
654 }; |
|
655 |
|
656 /** |
|
657 Event specific information returned as part of a TEventInfo object when |
|
658 a process is removed. Note that the Process may not be fully destroyed, |
|
659 so its resources should only be accessed if you already have a handle to it. |
|
660 */ |
|
661 class TRemoveProcessInfo |
|
662 { |
|
663 public: |
|
664 /** The name of the file that the process was created from. */ |
|
665 TUint8 iFileName[KMaxName]; |
|
666 /** Contains the length in bytes of the initialised data in iFileName. */ |
|
667 TInt iFileNameLength; |
|
668 TUint32 iSpare1; // Unused |
|
669 }; |
|
670 |
|
671 /** |
|
672 Event specific information returned as part of a TEventInfo object when |
|
673 a library unload event occurs. |
|
674 */ |
|
675 class TLibraryUnloadedInfo |
|
676 { |
|
677 public: |
|
678 /** The name of the file that the library was loaded from. */ |
|
679 TUint8 iFileName[KMaxName]; |
|
680 /** Contains the length in bytes of the initialised data in iFileName. */ |
|
681 TInt iFileNameLength; |
|
682 }; |
|
683 |
|
684 /** |
|
685 * Enum to represent the context of a user trace message |
|
686 */ |
|
687 enum TUserTraceMessageContext |
|
688 { |
|
689 ESingleMessage = 0x1, /** Indicates this message is the only one corresponding to a given user trace */ |
|
690 EMultiStart = 0x2, /** Indicates this message is the start of a user trace which consists of multiple messages */ |
|
691 EMultiMid = 0x3, /** Indicates this message is one in a series of user trace messages */ |
|
692 EMultiEnd = 0x4, /** Indicates this message is the last in a series of user trace messages */ |
|
693 /** |
|
694 @internalTechnology |
|
695 A debug agent should find the number of core tags from the DFBlock rather than this enumerator. |
|
696 */ |
|
697 ELast = 0x5 |
|
698 }; |
|
699 |
|
700 /** |
|
701 * Event specific information returned as part of a TEventInfo object |
|
702 * when a user trace event occurs. |
|
703 */ |
|
704 class TUserTraceInfo |
|
705 { |
|
706 public: |
|
707 /** The user trace text */ |
|
708 TUint8 iUserTraceText[TUserTraceSize]; |
|
709 |
|
710 /** User trace text length */ |
|
711 TInt iUserTraceLength; |
|
712 |
|
713 /** The context of the message */ |
|
714 TUserTraceMessageContext iMessageStatus; |
|
715 }; |
|
716 |
|
717 |
|
718 /** |
|
719 Structure used to store information about an event. An object of this type |
|
720 is passed as an argument to the RSecuritySvrSession::GetEvent function, |
|
721 and is filled in by the debug driver, and returned to the agent, when a |
|
722 relevant event occurs. |
|
723 |
|
724 The debug functionality block contains the size in bytes of the data that |
|
725 the driver will return when a GetEvent call is issued. A debug agent should |
|
726 ensure that this value equals the size of this TEventInfo object to ensure |
|
727 that a compatible debug driver is being used. The value is stored as |
|
728 EApiConstantsTEventInfoSize in the TFunctionalityApiConstants block. |
|
729 |
|
730 @see RSecuritySvrSession::GetDebugFunctionality |
|
731 @see RSecuritySvrSession::GetEvent |
|
732 */ |
|
733 class TEventInfo |
|
734 { |
|
735 public: |
|
736 |
|
737 /** Constructor sets all elements to default values. */ |
|
738 inline TEventInfo() { Reset(); }; |
|
739 |
|
740 /** Resets all values to default values. */ |
|
741 inline void Reset() |
|
742 { |
|
743 iProcessId = 0; |
|
744 iProcessIdValid = EFalse; |
|
745 iThreadId = 0; |
|
746 iThreadIdValid = EFalse; |
|
747 iEventType = (TEventType)NULL; |
|
748 iActionTaken = EActionIgnore; |
|
749 }; |
|
750 |
|
751 public: |
|
752 |
|
753 /** The process ID of the process which the event occurred in. */ |
|
754 TUint64 iProcessId; |
|
755 /** The thread ID of the thread which the event occurred in. */ |
|
756 TUint64 iThreadId; |
|
757 /** Has value ETrue if iProcessId is valid, EFalse otherwise. */ |
|
758 TUint8 iProcessIdValid; |
|
759 /** Has value ETrue if iThreadId is valid, EFalse otherwise. */ |
|
760 TUint8 iThreadIdValid; |
|
761 /** What action was taken by the debug system when it received the event. A TKernelEventAction */ |
|
762 TUint8 iActionTaken; |
|
763 TUint8 iSpare; |
|
764 |
|
765 /** Indicates the type of the event. This type should be used to determine |
|
766 the type of the information stored in the union which is part of this class. */ |
|
767 TEventType iEventType; |
|
768 union |
|
769 { |
|
770 /** Information which is specific to the break point event. */ |
|
771 TThreadBreakPointInfo iThreadBreakPointInfo; |
|
772 /** Information which is specific to the software exception event. */ |
|
773 TThreadSwExceptionInfo iThreadSwExceptionInfo; |
|
774 /** Information which is specific to the hardware exception event. */ |
|
775 TThreadHwExceptionInfo iThreadHwExceptionInfo; |
|
776 /** Information which is specific to the thread kill event. */ |
|
777 TThreadKillInfo iThreadKillInfo; |
|
778 /** Information which is specific to the library loaded event. */ |
|
779 TLibraryLoadedInfo iLibraryLoadedInfo; |
|
780 /** Information which is specific to the library unloaded event. */ |
|
781 TLibraryUnloadedInfo iLibraryUnloadedInfo; |
|
782 /** Information which is specific to the user trace event. */ |
|
783 TUserTraceInfo iUserTraceInfo; |
|
784 /** Information which is specific to the start thread event. */ |
|
785 TStartThreadInfo iStartThreadInfo; |
|
786 /** Information which is specific to the Add Process event. */ |
|
787 TAddProcessInfo iAddProcessInfo; |
|
788 /** Information which is specific to the Remove Process event. */ |
|
789 TRemoveProcessInfo iRemoveProcessInfo; |
|
790 }; |
|
791 }; |
|
792 |
|
793 /** |
|
794 @internalComponent |
|
795 */ |
|
796 class TProcessInfo |
|
797 { |
|
798 public: |
|
799 |
|
800 inline TProcessInfo() { Reset(); } |
|
801 |
|
802 inline TProcessInfo(TUint32 aId, TUint32 aCodeAddress, TUint32 aCodeSize, TUint32 aDataAddress) |
|
803 : iId(aId), |
|
804 iCodeAddress(aCodeAddress), |
|
805 iCodeSize(aCodeSize), |
|
806 iDataAddress(aDataAddress) { } |
|
807 |
|
808 inline void Reset() |
|
809 { |
|
810 iId = 0; |
|
811 iCodeAddress = 0; |
|
812 iCodeSize = 0; |
|
813 iDataAddress = 0; |
|
814 } |
|
815 |
|
816 public: |
|
817 |
|
818 TUint32 iId; |
|
819 TUint32 iCodeAddress; |
|
820 TUint32 iCodeSize; |
|
821 TUint32 iDataAddress; |
|
822 }; |
|
823 |
|
824 /* Other functionality may be defined here later */ |
|
825 |
|
826 /** |
|
827 Represents a register id value, in the terms of the Symbian ELF format: |
|
828 - bits 0-7 define the class |
|
829 - bits 8-15 define the rd_id |
|
830 - bits 16-31 define the rd_sub_id |
|
831 |
|
832 Both the core registers (TFunctionalityRegister type) and the coprocessor registers |
|
833 follow this identifier scheme. |
|
834 */ |
|
835 typedef TUint32 TRegisterInfo; |
|
836 |
|
837 /** |
|
838 Enum representing the status flags which could be returned from a register |
|
839 access call. |
|
840 */ |
|
841 enum TRegisterFlag |
|
842 { |
|
843 /** |
|
844 Default value, a register access call will never return this value |
|
845 */ |
|
846 ENotSet = 0, |
|
847 /** |
|
848 Would be returned if the register is supported by the debug driver but the kernel cannot access the register |
|
849 */ |
|
850 EInValid = 1, |
|
851 /** |
|
852 Would be returned if the register could be accessed correctly |
|
853 */ |
|
854 EValid = 2, |
|
855 /** |
|
856 Would be returned if the register is not supported by the debug driver |
|
857 */ |
|
858 ENotSupported = 3, |
|
859 /** |
|
860 Would be returned if a non-4 byte register value was requested |
|
861 */ |
|
862 EBadSize = 4 |
|
863 }; |
|
864 |
|
865 /** |
|
866 Enum representing the different ARM CPU instruction set architectures. |
|
867 */ |
|
868 enum TArchitectureMode |
|
869 { |
|
870 /** Represents the ARM CPU architecture. */ |
|
871 EArmMode = 1, |
|
872 /** Represents the Thumb CPU architecture. */ |
|
873 EThumbMode = 2, |
|
874 /** |
|
875 Represents the Thumb2 CPU architecture. |
|
876 @prototype |
|
877 */ |
|
878 EThumb2EEMode = 3 |
|
879 }; |
|
880 |
|
881 /** |
|
882 Used as an identifier for breakpoints set by the RSecuritySvrSession::SetBreak function. |
|
883 @see RSecuritySvrSession |
|
884 */ |
|
885 typedef TInt32 TBreakId; |
|
886 |
|
887 /** |
|
888 Specifies the type of a code segment. |
|
889 @see TCodeSegListEntry |
|
890 */ |
|
891 enum TCodeSegType |
|
892 { |
|
893 EUnknownCodeSegType = 0, /**< Signifies an unknown code segment type. */ |
|
894 EExeCodeSegType = 1, /**< Signifies a code segment belonging to an executable. */ |
|
895 EDllCodeSegType = 2 /**< Signifies a code segment belonging to a library. */ |
|
896 }; |
|
897 |
|
898 /** |
|
899 Structure used for extracting data from a descriptor returned by a call to |
|
900 RSecuritySvrSession::GetList() when GetList() is called with TListId::ECodeSegs |
|
901 as the first argument. |
|
902 |
|
903 @see RSecuritySvrSession::GetList() |
|
904 |
|
905 @code |
|
906 //buffer is a TDesC8 containing 4-byte aligned TCodeSegListEntry objects |
|
907 //create a pointer to the start of the data |
|
908 TUint8* ptr = (TUint8*)buffer.Ptr(); |
|
909 //create a pointer to the end of the data |
|
910 const TUint8* ptrEnd = ptr + buffer.Length(); |
|
911 while(ptr < ptrEnd) |
|
912 { |
|
913 //cast the pointer to be a TCodeSegListEntry object |
|
914 TCodeSegListEntry& entry = *(TCodeSegListEntry*)ptr; |
|
915 //use the TCodeSegListEntry pointer, i.e. |
|
916 TUint16 nameLength = entry.iNameLength; |
|
917 TPtr name(&(entry.iName[0]), nameLength, nameLength); |
|
918 // move ptr on to point to the next TCodeSegListEntry object |
|
919 ptr += Align4(entry.GetSize()); |
|
920 } |
|
921 @endcode |
|
922 */ |
|
923 class TCodeSegListEntry |
|
924 { |
|
925 public: |
|
926 TInt GetSize() const; |
|
927 public: |
|
928 /** |
|
929 Address of the start of the code segment. |
|
930 */ |
|
931 TUint32 iCodeBase; |
|
932 /** |
|
933 Size of the code segment. |
|
934 */ |
|
935 TUint32 iCodeSize; |
|
936 /** |
|
937 Size of the const data segment |
|
938 */ |
|
939 TUint32 iConstDataSize; |
|
940 /** |
|
941 Address of the initialised data |
|
942 */ |
|
943 TUint32 iInitialisedDataBase; |
|
944 /** |
|
945 Size of the initialised data |
|
946 */ |
|
947 TUint32 iInitialisedDataSize; |
|
948 /** |
|
949 Size of the uninitialised data |
|
950 */ |
|
951 TUint32 iUninitialisedDataSize; |
|
952 /** |
|
953 Boolean indicating whether the code segment is execute in place |
|
954 */ |
|
955 TBool iIsXip; |
|
956 /** |
|
957 Indicates whether the code segment is from an executable or a dll, or neither |
|
958 */ |
|
959 TCodeSegType iCodeSegType; |
|
960 /** Uid3 of this segment. */ |
|
961 TUint32 iUid3; |
|
962 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
963 TUint32 iSpare2; |
|
964 /** |
|
965 Length of the code segment's name |
|
966 */ |
|
967 TUint16 iNameLength; |
|
968 /** |
|
969 First two bytes of the code segment's name, the name should be considered to |
|
970 extend past the end of the TCodeSegListEntry structure to a length |
|
971 corresponding to iNameLength |
|
972 */ |
|
973 TUint16 iName[1]; |
|
974 }; |
|
975 |
|
976 /** |
|
977 Returns the size of the TCodeSegListEntry, including the file name length |
|
978 |
|
979 @return the size, in bytes, of the TCodeSegListEntry and the code segment's |
|
980 file name |
|
981 */ |
|
982 inline TInt TCodeSegListEntry::GetSize() const |
|
983 { |
|
984 return sizeof(TCodeSegListEntry) - sizeof(iName) + (2 * iNameLength); |
|
985 } |
|
986 |
|
987 /** |
|
988 Structure used for extracting data from a descriptor returned by a call to |
|
989 RSecuritySvrSession::GetList() when GetList() is called with TListId::EXipLibraries |
|
990 as the first argument. |
|
991 |
|
992 @see RSecuritySvrSession::GetList() |
|
993 |
|
994 @code |
|
995 //buffer is a TDesC8 containing 4-byte aligned TXipLibraryListEntry objects |
|
996 //create a pointer to the start of the data |
|
997 TUint8* ptr = (TUint8*)buffer.Ptr(); |
|
998 //create a pointer to the end of the data |
|
999 const TUint8* ptrEnd = ptr + buffer.Length(); |
|
1000 while(ptr < ptrEnd) |
|
1001 { |
|
1002 //cast the pointer to be a TXipLibraryListEntry object |
|
1003 TXipLibraryListEntry& entry = *(TXipLibraryListEntry*)ptr; |
|
1004 //use the TXipLibraryListEntry pointer, i.e. |
|
1005 TUint16 nameLength = entry.iNameLength; |
|
1006 TPtr name(&(entry.iName[0]), nameLength, nameLength); |
|
1007 // move ptr on to point to the next TXipLibraryListEntry object |
|
1008 ptr += Align4(entry.GetSize()); |
|
1009 } |
|
1010 @endcode |
|
1011 */ |
|
1012 class TXipLibraryListEntry |
|
1013 { |
|
1014 public: |
|
1015 TInt GetSize() const; |
|
1016 public: |
|
1017 /** |
|
1018 Address of the start of the library's code segment. |
|
1019 */ |
|
1020 TUint32 iCodeBase; |
|
1021 /** |
|
1022 Size of the code segment. |
|
1023 */ |
|
1024 TUint32 iCodeSize; |
|
1025 /** |
|
1026 Size of the const data segment |
|
1027 */ |
|
1028 TUint32 iConstDataSize; |
|
1029 /** |
|
1030 Address of the initialised data |
|
1031 */ |
|
1032 TUint32 iInitialisedDataBase; |
|
1033 /** |
|
1034 Size of the initialised data |
|
1035 */ |
|
1036 TUint32 iInitialisedDataSize; |
|
1037 /** |
|
1038 Size of the uninitialised data |
|
1039 */ |
|
1040 TUint32 iUninitialisedDataSize; |
|
1041 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
1042 TUint32 iSpare1; |
|
1043 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
1044 TUint32 iSpare2; |
|
1045 /** |
|
1046 Length of the library's name |
|
1047 */ |
|
1048 TUint16 iNameLength; |
|
1049 /** |
|
1050 First two bytes of the code segment's name, the name should be considered to |
|
1051 extend past the end of the TXipLibraryListEntry structure to a length |
|
1052 corresponding to iNameLength |
|
1053 */ |
|
1054 TUint16 iName[1]; |
|
1055 }; |
|
1056 |
|
1057 /** |
|
1058 Returns the size of the TXipLibraryListEntry, including the file name length |
|
1059 |
|
1060 @return the size, in bytes, of the TXipLibraryListEntry and the library's |
|
1061 file name |
|
1062 */ |
|
1063 inline TInt TXipLibraryListEntry::GetSize() const |
|
1064 { |
|
1065 return sizeof(TXipLibraryListEntry) - sizeof(iName) + (2 * iNameLength); |
|
1066 } |
|
1067 |
|
1068 /** |
|
1069 Structure used for extracting data from a descriptor returned by a call to |
|
1070 RSecuritySvrSession::GetList() when GetList() is called with TListId::EExecutables |
|
1071 as the first argument. |
|
1072 |
|
1073 @see RSecuritySvrSession::GetList() |
|
1074 |
|
1075 @code |
|
1076 //buffer is a TDesC8 containing 4-byte aligned TExecutablesListEntry objects |
|
1077 //create a pointer to the start of the data |
|
1078 TUint8* ptr = (TUint8*)buffer.Ptr(); |
|
1079 //create a pointer to the end of the data |
|
1080 const TUint8* ptrEnd = ptr + buffer.Length(); |
|
1081 while(ptr < ptrEnd) |
|
1082 { |
|
1083 //cast the pointer to be a TExecutablesListEntry object |
|
1084 TExecutablesListEntry& entry = *(TExecutablesListEntry*)ptr; |
|
1085 //use the TExecutablesListEntry pointer, i.e. |
|
1086 TUint16 nameLength = entry.iNameLength; |
|
1087 TPtr name(&(entry.iName[0]), nameLength, nameLength); |
|
1088 // move ptr on to point to the next TExecutablesListEntry object |
|
1089 ptr += Align4(entry.GetSize()); |
|
1090 } |
|
1091 @endcode |
|
1092 */ |
|
1093 class TExecutablesListEntry |
|
1094 { |
|
1095 public: |
|
1096 TInt GetSize() const; |
|
1097 public: |
|
1098 /** |
|
1099 Indicates whether an agent has registered to actively debug the executable, |
|
1100 a non-zero value indicates that an agent has attached. |
|
1101 */ |
|
1102 TUint8 iIsActivelyDebugged; |
|
1103 /** |
|
1104 Indicates whether any agents have registered to passively debug the executable, |
|
1105 a non-zero value indicates that at least one agent is attached passively |
|
1106 */ |
|
1107 TUint8 iIsPassivelyDebugged; |
|
1108 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
1109 TUint32 iSpare1; |
|
1110 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
1111 TUint32 iSpare2; |
|
1112 /** |
|
1113 Length of the executable's name |
|
1114 */ |
|
1115 TUint16 iNameLength; |
|
1116 /** |
|
1117 First two bytes of the executable's name, the name should be considered to |
|
1118 extend past the end of the TExecutablesListEntry structure to a length |
|
1119 corresponding to iNameLength |
|
1120 */ |
|
1121 TUint16 iName[1]; |
|
1122 }; |
|
1123 |
|
1124 /** |
|
1125 Returns the size of the TExecutablesListEntry, including the file name length |
|
1126 |
|
1127 @return the size, in bytes, of the TExecutablesListEntry and the executable's |
|
1128 file name |
|
1129 */ |
|
1130 inline TInt TExecutablesListEntry::GetSize() const |
|
1131 { |
|
1132 return sizeof(TExecutablesListEntry) - sizeof(iName) + (2*iNameLength); |
|
1133 } |
|
1134 |
|
1135 /** |
|
1136 Structure used for extracting data from a descriptor returned by a call to |
|
1137 RSecuritySvrSession::GetList() when GetList() is called with TListId::EProcesses |
|
1138 as the first argument. |
|
1139 |
|
1140 @see RSecuritySvrSession::GetList() |
|
1141 |
|
1142 @code |
|
1143 //buffer is a TDesC8 containing 4-byte aligned TProcessListEntry objects |
|
1144 //create a pointer to the start of the data |
|
1145 TUint8* ptr = (TUint8*)buffer.Ptr(); |
|
1146 //create a pointer to the end of the data |
|
1147 const TUint8* ptrEnd = ptr + buffer.Length(); |
|
1148 while(ptr < ptrEnd) |
|
1149 { |
|
1150 //cast the pointer to be a TProcessListEntry object |
|
1151 TProcessListEntry& entry = *(TProcessListEntry*)ptr; |
|
1152 //use the TProcessListEntry pointer, i.e. |
|
1153 TUint16 fileNameLength = entry.iFileNameLength; |
|
1154 TPtr name(&(entry.iNames[0]), fileNameLength, fileNameLength); |
|
1155 // move ptr on to point to the next TProcessListEntry object |
|
1156 ptr += Align4(entry.GetSize()); |
|
1157 } |
|
1158 @endcode |
|
1159 */ |
|
1160 class TProcessListEntry |
|
1161 { |
|
1162 public: |
|
1163 TInt GetSize() const; |
|
1164 |
|
1165 public: |
|
1166 /** Process ID */ |
|
1167 TUint64 iProcessId; |
|
1168 |
|
1169 /** The Uid3 of the process */ |
|
1170 TUint32 iUid3; |
|
1171 |
|
1172 /** |
|
1173 * Process Attributes |
|
1174 * @see DProcess::TProcessAttributes |
|
1175 */ |
|
1176 TInt iAttributes; |
|
1177 |
|
1178 /** |
|
1179 * Length of fully qualified file name of the process in bytes. Note that this |
|
1180 * entry may be 0 if the process is in the process of shutting down. |
|
1181 */ |
|
1182 TUint16 iFileNameLength; |
|
1183 |
|
1184 /** |
|
1185 * Length of current dynamic name of the process in bytes |
|
1186 */ |
|
1187 TUint16 iDynamicNameLength; |
|
1188 |
|
1189 /** |
|
1190 * First two bytes of the process' file name, the name should be considered to |
|
1191 * extend past the end of the TProcessListEntry structure to a length |
|
1192 * corresponding to iFileNameLength. Directly after the data corresponding to the |
|
1193 * file name, the dynamic name is stored with a length of iDynamicNameLength characters. |
|
1194 * Note that these names are not null terminated and are concatenated directly after each other. |
|
1195 * |
|
1196 * @code |
|
1197 * TProcessListEntry& entry; // entry is a reference to a TProcessListEntry |
|
1198 * |
|
1199 * //get the file name.. |
|
1200 * TPtr fileName(&(entry.iNames[0]), iFileNameLength, iFileNameLength); |
|
1201 * |
|
1202 * //get the dynamic name length.. |
|
1203 * TPtr dynamicName(&(entry.iNames[0]) + iFileNameLength, iDynamicNameLength, iDynamicNameLength); |
|
1204 * @endcode |
|
1205 */ |
|
1206 TUint16 iNames[1]; |
|
1207 }; |
|
1208 |
|
1209 /** |
|
1210 Returns the size of the TProcessListEntry, including the file name length and the |
|
1211 dynamic name length |
|
1212 |
|
1213 @return the size, in bytes, of the TProcessListEntry and the executable's |
|
1214 file name file name and dynamic name |
|
1215 */ |
|
1216 inline TInt TProcessListEntry::GetSize() const |
|
1217 { |
|
1218 return sizeof(TProcessListEntry) - sizeof(iNames) + (2 * (iFileNameLength + iDynamicNameLength)); |
|
1219 } |
|
1220 |
|
1221 /** |
|
1222 Structure used for extracting data from a descriptor returned by a call to |
|
1223 RSecuritySvrSession::GetList() when GetList() is called with TListId::EThreads |
|
1224 as the first argument. |
|
1225 |
|
1226 @see RSecuritySvrSession::GetList() |
|
1227 |
|
1228 @code |
|
1229 //buffer is a TDesC8 containing 4-byte aligned TThreadListEntry objects |
|
1230 //create a pointer to the start of the data |
|
1231 TUint8* ptr = (TUint8*)buffer.Ptr(); |
|
1232 //create a pointer to the end of the data |
|
1233 const TUint8* ptrEnd = ptr + buffer.Length(); |
|
1234 while(ptr < ptrEnd) |
|
1235 { |
|
1236 //cast the pointer to be a TThreadListEntry object |
|
1237 TThreadListEntry& entry = *(TThreadListEntry*)ptr; |
|
1238 //use the TThreadListEntry pointer, i.e. |
|
1239 TUint16 nameLength = entry.iNameLength; |
|
1240 TPtr name(&(entry.iName[0]), nameLength, nameLength); |
|
1241 // move ptr on to point to the next TThreadListEntry object |
|
1242 ptr += Align4(entry.GetSize()); |
|
1243 } |
|
1244 @endcode |
|
1245 */ |
|
1246 class TThreadListEntry |
|
1247 { |
|
1248 public: |
|
1249 TInt GetSize() const; |
|
1250 public: |
|
1251 /** |
|
1252 Thread ID |
|
1253 */ |
|
1254 TUint64 iThreadId; |
|
1255 /** |
|
1256 Process ID |
|
1257 */ |
|
1258 TUint64 iProcessId; |
|
1259 /** |
|
1260 Address of the base of the supervisor stack |
|
1261 */ |
|
1262 TUint32 iSupervisorStackBase; |
|
1263 /** |
|
1264 Size of the supervisor stack |
|
1265 */ |
|
1266 TUint32 iSupervisorStackSize; |
|
1267 /** |
|
1268 Non-zero if iSupervisorStackBase has been set correctly |
|
1269 */ |
|
1270 TUint8 iSupervisorStackBaseValid; |
|
1271 /** |
|
1272 Non-zero if iSupervisorStackSize has been set correctly |
|
1273 */ |
|
1274 TUint8 iSupervisorStackSizeValid; |
|
1275 /** |
|
1276 Address of the thread's supervisor stack pointer |
|
1277 */ |
|
1278 TUint32 iSupervisorStackPtr; |
|
1279 /** |
|
1280 Indicator of whether the value returned as iSupervisorStackPtr is valid. |
|
1281 It is necessary, but not necessarily sufficient, that the thread be suspended |
|
1282 for a valid value to be returned. This may be removed from the final API and |
|
1283 the value would be extracted instead via the ReadRegisters type calls. |
|
1284 */ |
|
1285 TRegisterFlag iSupervisorStackPtrValid; |
|
1286 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
1287 TUint32 iSpare1; |
|
1288 /** Currently unused element. May be used in future to aid maintaining compatibility. */ |
|
1289 TUint32 iSpare2; |
|
1290 /** |
|
1291 The length of the thread's name |
|
1292 */ |
|
1293 TUint16 iNameLength; |
|
1294 /** |
|
1295 First two bytes of the thread's name, the name should be considered to |
|
1296 extend past the end of the TThreadListEntry structure to a length |
|
1297 corresponding to iNameLength |
|
1298 */ |
|
1299 TUint16 iName[1]; |
|
1300 }; |
|
1301 |
|
1302 /** |
|
1303 Returns the size of the TThreadListEntry, including the name length |
|
1304 |
|
1305 @return the size, in bytes, of the TExecutablesListEntry and the thread's name |
|
1306 */ |
|
1307 inline TInt TThreadListEntry::GetSize() const |
|
1308 { |
|
1309 return sizeof(TThreadListEntry) - sizeof(iName) + (2 * iNameLength); |
|
1310 } |
|
1311 |
|
1312 /** |
|
1313 Denotes which list type to return from a RSecuritySvrSession::GetList() call |
|
1314 |
|
1315 @see RSecuritySvrSession::GetList() |
|
1316 */ |
|
1317 enum TListId |
|
1318 { |
|
1319 /** |
|
1320 Indicates that the GetList() call should return a list of the processes in |
|
1321 the system. The returned buffer will contain an array of 4-byte aligned |
|
1322 TProcessListEntry objects. |
|
1323 |
|
1324 @see TProcessListEntry |
|
1325 */ |
|
1326 EProcesses = 0, |
|
1327 /** |
|
1328 Indicates that the GetList() call should return a list of the threads in |
|
1329 the system. The returned buffer will contain an array of 4-byte aligned |
|
1330 TThreadListEntry objects. |
|
1331 |
|
1332 @see TThreadListEntry |
|
1333 */ |
|
1334 EThreads = 1, |
|
1335 /** |
|
1336 Indicates that the GetList() call should return a list of the code segments in |
|
1337 the system. The returned buffer will contain an array of 4-byte aligned |
|
1338 TCodeSegListEntry objects. |
|
1339 |
|
1340 @see TCodeSegListEntry |
|
1341 */ |
|
1342 ECodeSegs = 2, |
|
1343 /** |
|
1344 Indicates that the GetList() call should return a list of the XIP libraries in |
|
1345 the system. The returned buffer will contain an array of 4-byte aligned |
|
1346 EXipLibraries objects. |
|
1347 |
|
1348 @see EXipLibraries |
|
1349 */ |
|
1350 EXipLibraries = 3, |
|
1351 /** |
|
1352 Indicates that the GetList() call should return a list of the executables in |
|
1353 the system. The returned buffer will contain an array of 4-byte aligned |
|
1354 EExecutables objects. |
|
1355 |
|
1356 @see EExecutables |
|
1357 */ |
|
1358 EExecutables = 4, |
|
1359 /** |
|
1360 Indicates that the GetList() call should return a list of the logical devices in the system. |
|
1361 */ |
|
1362 ELogicalDevices = 5, |
|
1363 /** |
|
1364 Indicates that the GetList() call should return a list of the mutexes in the system. |
|
1365 */ |
|
1366 EMutexes = 6, |
|
1367 /** |
|
1368 Indicates that the GetList() call should return a list of the servers in the system. |
|
1369 */ |
|
1370 EServers = 7, |
|
1371 /** |
|
1372 Indicates that the GetList() call should return a list of the sessions in the system. |
|
1373 */ |
|
1374 ESessions = 8, |
|
1375 /** |
|
1376 Indicates that the GetList() call should return a list of the semaphores in the system. |
|
1377 */ |
|
1378 ESemaphores = 9, |
|
1379 /** |
|
1380 Indicates that the GetList() call should return a list of the chunks in the system. |
|
1381 */ |
|
1382 EChunks = 10, |
|
1383 |
|
1384 /** |
|
1385 Provides a complete list of all the breakpoints in the system and their |
|
1386 current state. |
|
1387 |
|
1388 @see EBreakpoints |
|
1389 */ |
|
1390 EBreakpoints = 11, |
|
1391 |
|
1392 /** |
|
1393 The following are for the possible use of kernel-side debug and SMP breakpoint |
|
1394 manipulation. |
|
1395 */ |
|
1396 ESetBreak = 12, |
|
1397 ERemoveBreak = 13, |
|
1398 EModifyBreak = 14, |
|
1399 |
|
1400 /** |
|
1401 * Provides static information of the system |
|
1402 */ |
|
1403 EStaticInfo = 15, |
|
1404 |
|
1405 /** Last listing enum. */ |
|
1406 EListLast |
|
1407 }; |
|
1408 |
|
1409 /** |
|
1410 Bit field values denoting the scope of a listing. |
|
1411 |
|
1412 In the debug functionality block, the TTag::iValue element which is returned for a listing tag |
|
1413 should be considered as a union of the supported values from this enumeration for that listing. |
|
1414 */ |
|
1415 enum TListScope |
|
1416 { |
|
1417 EScopeNone = 0x0, /**< Corresponds to no scope for a listing. equivalent to not supported */ |
|
1418 EScopeGlobal= 0x1, /**< Corresponds to a global scope for a listing. */ |
|
1419 EScopeProcessSpecific = 0x2, /**< Corresponds to a process specific scope for a listing. */ |
|
1420 EScopeThreadSpecific = 0x4 /**< Corresponds to a thread specific scope for a listing. */ |
|
1421 }; |
|
1422 |
|
1423 /** |
|
1424 @internalComponent |
|
1425 |
|
1426 Interface constructor for passing IPC data for the GetList call. |
|
1427 */ |
|
1428 class TListDetails |
|
1429 { |
|
1430 public: |
|
1431 TListDetails(const TListId aListId, const TListScope aListScope, TUint64 aTargetId=0) |
|
1432 : iListId(aListId), |
|
1433 iListScope(aListScope), |
|
1434 iTargetId(aTargetId) {} |
|
1435 public: |
|
1436 TListId iListId; |
|
1437 TListScope iListScope; |
|
1438 TUint64 iTargetId; |
|
1439 }; |
|
1440 |
|
1441 /** Debug Security Server Secure ID */ |
|
1442 const TUid KUidDebugSecurityServer = { 0x102834E2 }; |
|
1443 |
|
1444 } // end of Debug namespace declaration |
|
1445 |
|
1446 // the remaining functionality in this file is intended for use on user side only |
|
1447 #ifndef __KERNEL_MODE__ |
|
1448 |
|
1449 #include <e32std.h> |
|
1450 |
|
1451 // API definition for Debug namespace appears elsewhere in this file. |
|
1452 namespace Debug { |
|
1453 |
|
1454 /** The name of the Debug Security Server. */ |
|
1455 _LIT(KSecurityServerName,"DebugSecurityServer"); |
|
1456 |
|
1457 /** Wildcard used for attach all calls */ |
|
1458 _LIT(KStar, "*"); |
|
1459 |
|
1460 // A version must be specified when creating a session with the server |
|
1461 /** The Debug Security Server's major version number. */ |
|
1462 const TUint KDebugServMajorVersionNumber=2; |
|
1463 /** The Debug Security Server's minor version number. */ |
|
1464 const TUint KDebugServMinorVersionNumber=5; |
|
1465 /** The Debug Security Server's patch version number. */ |
|
1466 const TUint KDebugServPatchVersionNumber=0; |
|
1467 |
|
1468 /** |
|
1469 Denotes how memory should be accessed |
|
1470 */ |
|
1471 enum TAccess |
|
1472 { |
|
1473 EAccess8 = 1, /**< Currently unsupported, signifies 8 bit access. */ |
|
1474 EAccess16 = 2, /**< Currently unsupported, signifies 16 bit access. */ |
|
1475 EAccess32 = 4 /**< Signifies 32 bit access. */ |
|
1476 }; |
|
1477 |
|
1478 /** |
|
1479 Denotes how data should be interpreted |
|
1480 */ |
|
1481 enum TEndianess |
|
1482 { |
|
1483 EEndLE8 = 0, /**< Signifies 8 bit little-endian. */ |
|
1484 EEndBE8 = 1, /**< Currently unsupported, signifies 8 bit big-endian. */ |
|
1485 EEndBE32 = 2 /**< Currently unsupported, signifies 32 bit big-endian. */ |
|
1486 }; |
|
1487 |
|
1488 /** |
|
1489 Structure used to store information about a memory operation |
|
1490 |
|
1491 @internalComponent |
|
1492 */ |
|
1493 class TMemoryInfo |
|
1494 { |
|
1495 public: |
|
1496 |
|
1497 TMemoryInfo(TUint32 aAddress=0, TUint32 aLength=0, TAccess aAccess=EAccess32, TEndianess aEndianess=EEndLE8) |
|
1498 : iAddress(aAddress), |
|
1499 iSize(aLength), |
|
1500 iAccess(aAccess), |
|
1501 iEndianess(aEndianess) |
|
1502 {} |
|
1503 |
|
1504 public: |
|
1505 |
|
1506 /** |
|
1507 Address to start reading/writing memory |
|
1508 */ |
|
1509 TUint32 iAddress; |
|
1510 /** |
|
1511 Number of bytes of memory to read/write |
|
1512 */ |
|
1513 TUint32 iSize; |
|
1514 /** |
|
1515 Access size for read/write |
|
1516 @see TAccess |
|
1517 */ |
|
1518 TAccess iAccess; |
|
1519 /** |
|
1520 Endianess to interpret data as |
|
1521 @see TEndianess |
|
1522 */ |
|
1523 TEndianess iEndianess; |
|
1524 }; |
|
1525 |
|
1526 /** |
|
1527 @internalComponent |
|
1528 */ |
|
1529 class TBreakInfo |
|
1530 { |
|
1531 public: |
|
1532 TUint32 iAddress; |
|
1533 TArchitectureMode iArchitectureMode; |
|
1534 }; |
|
1535 |
|
1536 /** |
|
1537 @internalComponent |
|
1538 |
|
1539 Function codes (opcodes) used in message passing between client and server |
|
1540 in this header file and what arguments should be passed with each of these |
|
1541 */ |
|
1542 enum TDebugServRqst |
|
1543 { |
|
1544 EDebugServOpen = 1, |
|
1545 EDebugServClose = 2, |
|
1546 EDebugServSuspendThread = 3, |
|
1547 EDebugServResumeThread = 4, |
|
1548 EDebugServReadMemory = 5, |
|
1549 EDebugServWriteMemory = 6, |
|
1550 EDebugServSetBreak = 7, |
|
1551 EDebugServClearBreak = 8, |
|
1552 EDebugServModifyBreak = 9, |
|
1553 EDebugServGetEvent = 10, |
|
1554 EDebugServCancelGetEvent = 11, |
|
1555 EDebugServAttachExecutable = 12, |
|
1556 EDebugServDetachExecutable = 13, |
|
1557 EDebugServGetDebugFunctionalityBufSize = 14, |
|
1558 EDebugServGetDebugFunctionality = 15, |
|
1559 EDebugServReadRegisters = 16, |
|
1560 EDebugServWriteRegisters = 17, |
|
1561 EDebugServSetEventAction = 18, |
|
1562 EDebugServBreakInfo = 19, |
|
1563 EDebugServGetList = 20, |
|
1564 EDebugServStep = 21, |
|
1565 EDebugServSetProcessBreak = 22, |
|
1566 EDebugServProcessBreakInfo = 23, |
|
1567 EDebugServKillProcess = 24, |
|
1568 EDebugServModifyProcessBreak = 25, |
|
1569 EDebugServReadCrashFlash = 26, |
|
1570 EDebugServWriteCrashFlash = 27, |
|
1571 EDebugServEraseCrashFlash = 28, |
|
1572 EDebugServEraseEntireCrashFlash = 29, |
|
1573 EDebugServAttachAll = 30, |
|
1574 EDebugServDetachAll = 31, |
|
1575 }; |
|
1576 |
|
1577 /** |
|
1578 Client side API to debug security server (DSS). Interaction with the DSS should |
|
1579 be conducted through this class only. |
|
1580 */ |
|
1581 class RSecuritySvrSession : public RSessionBase |
|
1582 { |
|
1583 public: |
|
1584 RSecuritySvrSession(); |
|
1585 TVersion Version() const; |
|
1586 |
|
1587 TInt AttachExecutable(const TDesC& aProcessName, TBool aPassive); |
|
1588 TInt DetachExecutable(const TDesC& aProcessName); |
|
1589 |
|
1590 TInt GetDebugFunctionalityBufSize(TUint32* aBufSize); |
|
1591 TInt GetDebugFunctionality(TDes8& aBuffer); |
|
1592 |
|
1593 TInt SuspendThread(const TThreadId aThreadId); |
|
1594 TInt ResumeThread(const TThreadId aThreadId); |
|
1595 |
|
1596 TInt ReadMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData, const TAccess aAccessSize, const TEndianess aEndianess); |
|
1597 TInt WriteMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData, const TAccess aAccessSize, const TEndianess aEndianess); |
|
1598 |
|
1599 TInt ReadRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, TDes8& aRegisterValues, TDes8& aRegisterFlags); |
|
1600 TInt WriteRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, const TDesC8& aRegisterValues, TDes8& aRegisterFlags); |
|
1601 |
|
1602 void GetEvent(const TDesC& aExecutableName, TRequestStatus &aStatus, TDes8& aEventInfo); |
|
1603 TInt CancelGetEvent(const TDesC& aExecutableName); |
|
1604 |
|
1605 TInt SetEventAction(const TDesC& aExecutableName, TEventType aEvent, TKernelEventAction aEventAction); |
|
1606 |
|
1607 TInt SetBreak( TBreakId &aId, const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode); |
|
1608 TInt ClearBreak(const TBreakId aBreakId); |
|
1609 TInt ModifyBreak(const TBreakId aBreakId, const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode); |
|
1610 TInt BreakInfo(const TBreakId aBreakId, TThreadId& aThreadId, TUint32& aAddress, TArchitectureMode& aMode); |
|
1611 TInt SetProcessBreak( TBreakId &aId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode); |
|
1612 TInt ProcessBreakInfo(const TBreakId aBreakId, TProcessId& aProcessId, TUint32& aAddress, TArchitectureMode& aMode); |
|
1613 TInt ModifyProcessBreak(const TBreakId aBreakId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode); |
|
1614 |
|
1615 TInt GetList(const TListId aListId, TDes8& aListData, TUint32& aDataSize); |
|
1616 TInt GetList(const TThreadId aThreadId, const TListId aListId, TDes8& aListData, TUint32& aDataSize); |
|
1617 TInt GetList(const TProcessId aProcessId, const TListId aListId, TDes8& aListData, TUint32& aDataSize); |
|
1618 TInt Step(const TThreadId aThreadId, TUint32 aNumSteps); |
|
1619 TInt KillProcess(const TProcessId aProcessId, const TInt aReason); |
|
1620 TInt ReadCrashLog(const TUint32 aPos, TDes8& aData, const TUint32 aDataSize); |
|
1621 TInt WriteCrashConfig(const TUint32 aPos, const TDesC8& aBuffer, TUint32& aSize); |
|
1622 TInt EraseCrashLog(const TUint32 aPos, const TUint32 aBlockNumber); |
|
1623 TInt EraseCrashFlashPartition(); |
|
1624 |
|
1625 TInt Connect(const TVersion aVersion); |
|
1626 |
|
1627 // Added in version 2.5 |
|
1628 TInt AttachAll(); |
|
1629 TInt DetachAll(); |
|
1630 void GetEvent(TRequestStatus &aStatus, TDes8& aEventInfo); |
|
1631 TInt CancelGetEvent(); |
|
1632 TInt SetEventAction(TEventType aEvent, TKernelEventAction aEventAction); |
|
1633 |
|
1634 private: |
|
1635 TInt StartServer(void); |
|
1636 }; |
|
1637 |
|
1638 /** |
|
1639 Server session constructor |
|
1640 */ |
|
1641 inline RSecuritySvrSession::RSecuritySvrSession() |
|
1642 { |
|
1643 } |
|
1644 |
|
1645 /** |
|
1646 Called by a client to create a session with the DSS. This method starts the |
|
1647 DSS if it is not running, or connects to it if it already exists. |
|
1648 |
|
1649 @param aVersion version of the DSS to connect to |
|
1650 |
|
1651 @return KErrNone if a connection was successfully created, or one of the other |
|
1652 system wide error codes |
|
1653 */ |
|
1654 inline TInt RSecuritySvrSession::Connect(const TVersion aVersion) |
|
1655 { |
|
1656 // Default asynch outstanding message slots for the server. Not that these are |
|
1657 // allocated from a system-wide pool of 255, so have to be careful with resources. |
|
1658 const TUint KDefaultMessageSlots = 8; |
|
1659 |
|
1660 TInt retry=2; |
|
1661 for (;;) |
|
1662 { |
|
1663 TInt r=CreateSession(KSecurityServerName, aVersion, KDefaultMessageSlots); |
|
1664 if (r!=KErrNotFound && r!=KErrServerTerminated) |
|
1665 { |
|
1666 return r; |
|
1667 } |
|
1668 if (--retry==0) |
|
1669 { |
|
1670 return r; |
|
1671 } |
|
1672 r=StartServer(); |
|
1673 if (r!=KErrNone && r!=KErrAlreadyExists) |
|
1674 { |
|
1675 return r; |
|
1676 } |
|
1677 } |
|
1678 } |
|
1679 |
|
1680 /** |
|
1681 Start the server |
|
1682 |
|
1683 @return KErrNone on success, or one of the other system wide error codes |
|
1684 */ |
|
1685 inline TInt RSecuritySvrSession::StartServer() |
|
1686 { |
|
1687 // constants for the server |
|
1688 _LIT(KSecurityServerProcessName, "rm_debug_svr"); |
|
1689 const TUidType serverUid(KNullUid, KNullUid, KUidDebugSecurityServer); |
|
1690 |
|
1691 RProcess server; |
|
1692 TInt err = server.Create(KSecurityServerProcessName, KNullDesC, serverUid); |
|
1693 |
|
1694 if(KErrNone != err) |
|
1695 { |
|
1696 return err; |
|
1697 } |
|
1698 |
|
1699 // Synchronise with the process to make sure it hasn't died straight away |
|
1700 TRequestStatus stat; |
|
1701 server.Rendezvous(stat); |
|
1702 if (stat != KRequestPending) |
|
1703 { |
|
1704 // logon failed - server is not yet running, so cannot have terminated |
|
1705 server.Kill(0); // Abort startup |
|
1706 } |
|
1707 else |
|
1708 { |
|
1709 // logon OK - start the server |
|
1710 server.Resume(); |
|
1711 } |
|
1712 |
|
1713 // Wait to synchronise with server - if it dies in the meantime, it |
|
1714 // also gets completed |
|
1715 User::WaitForRequest(stat); |
|
1716 |
|
1717 // We can't use the 'exit reason' if the server panicked as this |
|
1718 // is the panic 'reason' and may be '0' which cannot be distinguished |
|
1719 // from KErrNone |
|
1720 err = (server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); |
|
1721 server.Close(); |
|
1722 return err; |
|
1723 } |
|
1724 |
|
1725 /** |
|
1726 Get version of RSecuritySvrSession |
|
1727 |
|
1728 @return a TVersion object specifying the version |
|
1729 */ |
|
1730 inline TVersion RSecuritySvrSession::Version(void) const |
|
1731 { |
|
1732 return (TVersion(KDebugServMajorVersionNumber, KDebugServMinorVersionNumber, KDebugServPatchVersionNumber)); |
|
1733 } |
|
1734 |
|
1735 /** |
|
1736 Suspends execution of the specified thread. |
|
1737 |
|
1738 @param aThreadId thread ID of the thread to suspend |
|
1739 |
|
1740 @return KErrNone if there were no problems, KErrPermissionDenied if security |
|
1741 check fails or KErrArgument if the thread does not exist |
|
1742 */ |
|
1743 inline TInt RSecuritySvrSession::SuspendThread(const TThreadId aThreadId) |
|
1744 { |
|
1745 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
1746 TIpcArgs args(&threadIdPckg); |
|
1747 |
|
1748 return SendReceive(EDebugServSuspendThread, args); |
|
1749 } |
|
1750 |
|
1751 /** |
|
1752 Resumes execution of the specified thread. |
|
1753 |
|
1754 @param aThreadId thread ID of the thread to resume |
|
1755 |
|
1756 @return KErrNone if there were no problems, KErrPermissionDenied if security |
|
1757 check fails or KErrArgument if the thread does not exist |
|
1758 */ |
|
1759 inline TInt RSecuritySvrSession::ResumeThread(const TThreadId aThreadId) |
|
1760 { |
|
1761 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
1762 TIpcArgs args(&threadIdPckg); |
|
1763 |
|
1764 return SendReceive(EDebugServResumeThread, args); |
|
1765 } |
|
1766 |
|
1767 /** |
|
1768 Purpose: |
|
1769 Set a thread-specific breakpoint in an attached process. |
|
1770 |
|
1771 @pre Debug Agent must be connected to the debug security server |
|
1772 @pre Debug Agent must be attached to a process. |
|
1773 |
|
1774 @param aThreadId The thread id to which the breakpoint will apply. |
|
1775 @param aAddress The virtual memory address at which to place the breakpoint. |
|
1776 @param aArchitectureMode The kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE) |
|
1777 @param aBreakId The address to which the assigned breakpoint ID will be written by this function |
|
1778 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1779 */ |
|
1780 inline TInt RSecuritySvrSession::SetBreak( TBreakId &aBreakId,const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode) |
|
1781 { |
|
1782 TPtr8 breakIdPtr((TUint8*)&aBreakId, sizeof(aBreakId)); |
|
1783 |
|
1784 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
1785 |
|
1786 TBreakInfo breakInfo; |
|
1787 breakInfo.iAddress = aAddress; |
|
1788 breakInfo.iArchitectureMode = aArchitectureMode; |
|
1789 TPckgBuf<TBreakInfo> breakInfoPckg(breakInfo); |
|
1790 |
|
1791 //call driver to attempt to set break |
|
1792 TIpcArgs args(&threadIdPckg, &breakInfoPckg, &breakIdPtr); |
|
1793 return SendReceive(EDebugServSetBreak, args); |
|
1794 } |
|
1795 |
|
1796 /** |
|
1797 Purpose: |
|
1798 Clears a previously set thread-specific or process-specific breakpoint. |
|
1799 |
|
1800 @pre Debug Agent must be connected to the debug security server |
|
1801 @pre Debug Agent must be attached to a process. |
|
1802 |
|
1803 @param aBreakId The TBreakId returned by a prior SetBreak call. Must have been set by the same Debug Agent. |
|
1804 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1805 */ |
|
1806 inline TInt RSecuritySvrSession::ClearBreak(const TBreakId aBreakId) |
|
1807 { |
|
1808 TIpcArgs args(aBreakId); |
|
1809 return SendReceive(EDebugServClearBreak, args); |
|
1810 } |
|
1811 |
|
1812 /** |
|
1813 Purpose: |
|
1814 Modifies the properties of a previously set breakpoint. |
|
1815 |
|
1816 @pre Debug Agent must be connected to the debug security server |
|
1817 @pre Debug Agent must be attached to a process. |
|
1818 |
|
1819 @param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent. |
|
1820 @param aThreadId the thread id of the thread to move the breakpoint to |
|
1821 @param aAddress the virtual memory address at which to place the breakpoint. |
|
1822 @param aArchitectureMode the kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE) |
|
1823 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1824 */ |
|
1825 inline TInt RSecuritySvrSession::ModifyBreak(const TBreakId aBreakId, const TThreadId aThreadId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode) |
|
1826 |
|
1827 { |
|
1828 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
1829 TIpcArgs args(aBreakId,&threadIdPckg,aAddress,aArchitectureMode); |
|
1830 return SendReceive(EDebugServModifyBreak, args); |
|
1831 } |
|
1832 |
|
1833 /** |
|
1834 Purpose: |
|
1835 Modifies the properties of a previously set process breakpoint. |
|
1836 |
|
1837 @pre Debug Agent must be connected to the debug security server |
|
1838 @pre Debug Agent must be attached to a process. |
|
1839 |
|
1840 @param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent. |
|
1841 @param aProcessId the process id of the process to move the breakpoint to |
|
1842 @param aAddress the virtual memory address at which to place the breakpoint. |
|
1843 @param aArchitectureMode the kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE) |
|
1844 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1845 */ |
|
1846 inline TInt RSecuritySvrSession::ModifyProcessBreak(const TBreakId aBreakId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode) |
|
1847 |
|
1848 { |
|
1849 TPckgBuf<TProcessId> processIdPckg(aProcessId); |
|
1850 TIpcArgs args(aBreakId,&processIdPckg,aAddress,aArchitectureMode); |
|
1851 return SendReceive(EDebugServModifyProcessBreak, args); |
|
1852 } |
|
1853 |
|
1854 /** |
|
1855 Purpose: |
|
1856 Returns the properties associated with a given TBreakId. The supplied break id must previously have been allocated |
|
1857 to the debug agent by a SetBreak() call. |
|
1858 |
|
1859 @pre Debug Agent must be connected to the debug security server |
|
1860 @pre Debug Agent must be attached to a process. |
|
1861 @pre The aBreakId must have been previously returned by a SetBreak() call and not subsequently cleared by ClearBreak(). |
|
1862 |
|
1863 @param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent. |
|
1864 @param aAddress on return contains the virtual memory address of the breakpoint |
|
1865 @param aThreadId on return contains the thread id of the thread that the breakpoint is set in |
|
1866 @param aMode on return contains the type of this breakpoint (e.g. ARM/Thumb/Thumb2EE) |
|
1867 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1868 */ |
|
1869 inline TInt RSecuritySvrSession::BreakInfo(const TBreakId aBreakId, TThreadId& aThreadId, TUint32& aAddress, TArchitectureMode& aMode) |
|
1870 { |
|
1871 // temporary descriptors |
|
1872 TPtr8 threadId((TUint8*)&aThreadId,0,sizeof(TThreadId)); |
|
1873 TPtr8 address((TUint8*)&aAddress,0,sizeof(TUint32)); |
|
1874 TPtr8 mode((TUint8*)&aMode,0,sizeof(TArchitectureMode)); |
|
1875 |
|
1876 TIpcArgs args(aBreakId,&threadId,&address,&mode); |
|
1877 return SendReceive(EDebugServBreakInfo, args); |
|
1878 } |
|
1879 |
|
1880 /** |
|
1881 Purpose: |
|
1882 Set a process-specific breakpoint in an attached process. |
|
1883 |
|
1884 @pre Debug Agent must be connected to the debug security server |
|
1885 @pre Debug Agent must be attached to a process. |
|
1886 |
|
1887 @param aProcessId The process id to which the breakpoint will apply. |
|
1888 @param aAddress The virtual memory address at which to place the breakpoint. |
|
1889 @param aArchitectureMode The kind of breakpoint which is to be set (e.g. ARM/Thumb/Thumb2EE) |
|
1890 @param aBreakId The address to which the assigned breakpoint ID will be written by this function |
|
1891 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1892 */ |
|
1893 inline TInt RSecuritySvrSession::SetProcessBreak( TBreakId &aBreakId, const TProcessId aProcessId, const TUint32 aAddress, const TArchitectureMode aArchitectureMode) |
|
1894 { |
|
1895 TPtr8 breakIdPtr((TUint8*)&aBreakId, sizeof(aBreakId)); |
|
1896 |
|
1897 TPckgBuf<TProcessId> threadIdPckg(aProcessId); |
|
1898 |
|
1899 TBreakInfo breakInfo; |
|
1900 breakInfo.iAddress = aAddress; |
|
1901 breakInfo.iArchitectureMode = aArchitectureMode; |
|
1902 TPckgBuf<TBreakInfo> breakInfoPckg(breakInfo); |
|
1903 |
|
1904 //call driver to attempt to set break |
|
1905 TIpcArgs args(&threadIdPckg, &breakInfoPckg, &breakIdPtr); |
|
1906 return SendReceive(EDebugServSetProcessBreak, args); |
|
1907 } |
|
1908 |
|
1909 /** |
|
1910 Purpose: |
|
1911 Returns the properties associated with a given TBreakId. The supplied break id must previously have been allocated |
|
1912 to the debug agent by a SetProcessBreak() call. |
|
1913 |
|
1914 @pre Debug Agent must be connected to the debug security server |
|
1915 @pre Debug Agent must be attached to a process. |
|
1916 @pre The aBreakId must have been previously returned by a SetProcessBreak() call and not subsequently cleared by ClearBreak(). |
|
1917 |
|
1918 @param aBreakId the TBreakId returned by a prior SetBreak() call. Must have been set by the same Debug Agent. |
|
1919 @param aAddress on return contains the virtual memory address of the breakpoint |
|
1920 @param aThreadId on return contains the thread id of the thread that the breakpoint is set in |
|
1921 @param aMode on return contains the type of this breakpoint (e.g. ARM/Thumb/Thumb2EE) |
|
1922 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1923 */ |
|
1924 inline TInt RSecuritySvrSession::ProcessBreakInfo(const TBreakId aBreakId, TProcessId& aProcessId, TUint32& aAddress, TArchitectureMode& aMode) |
|
1925 { |
|
1926 // temporary descriptors |
|
1927 TPtr8 processId((TUint8*)&aProcessId,0,sizeof(TProcessId)); |
|
1928 TPtr8 address((TUint8*)&aAddress,0,sizeof(TUint32)); |
|
1929 TPtr8 mode((TUint8*)&aMode,0,sizeof(TArchitectureMode)); |
|
1930 |
|
1931 TIpcArgs args(aBreakId,&processId,&address,&mode); |
|
1932 return SendReceive(EDebugServProcessBreakInfo, args); |
|
1933 } |
|
1934 |
|
1935 /** |
|
1936 Purpose: |
|
1937 Wait for an event to occur to the target executable being debugged. When an event |
|
1938 occurs, the TRequestStatus is completed. |
|
1939 |
|
1940 @pre Debug Agent must be connected to the debug security server |
|
1941 @pre Debug Agent must be attached to a process. |
|
1942 |
|
1943 Note 1: Events are reported on a per-executable basis, not per-thread. |
|
1944 |
|
1945 Note 2: All the parameters must remain in scope until either CancelGetEvent is called, or |
|
1946 until the request is completed. In practice, this generally |
|
1947 means these parameters should not be based on the stack, as they may go out of |
|
1948 scope before the call completes. |
|
1949 |
|
1950 Note 3: Errors are signalled by completing aStatus |
|
1951 |
|
1952 @param aExecutableName The name of any executable to which the Debug Agent is attached. |
|
1953 @param aStatus Debug Agent request status variable. |
|
1954 @param aEventInfo Descriptor containing a TEventInfo object. |
|
1955 |
|
1956 */ |
|
1957 inline void RSecuritySvrSession::GetEvent(const TDesC& aExecutableName, TRequestStatus &aStatus, TDes8& aEventInfo) |
|
1958 { |
|
1959 TIpcArgs args(&aExecutableName, &aEventInfo); |
|
1960 |
|
1961 SendReceive(EDebugServGetEvent, args, aStatus ); |
|
1962 |
|
1963 } |
|
1964 |
|
1965 /** |
|
1966 Purpose: |
|
1967 Cancel a previously issued asynchronous RSecuritySvrSession::GetEvent call. |
|
1968 |
|
1969 @pre Debug Agent must be connected to the debug security server |
|
1970 @pre Debug Agent should have called AttachExecutable and GetEvent for the same executable |
|
1971 |
|
1972 @param aExecutableName The name of the executable being debugged. |
|
1973 @return Any error which may be returned by RSessionBase::SendReceive() |
|
1974 */ |
|
1975 inline TInt RSecuritySvrSession::CancelGetEvent(const TDesC& aExecutableName) |
|
1976 { |
|
1977 TIpcArgs args(&aExecutableName); |
|
1978 |
|
1979 return SendReceive(EDebugServCancelGetEvent,args); |
|
1980 } |
|
1981 |
|
1982 |
|
1983 /** |
|
1984 Purpose: |
|
1985 Wait for an event to occur from any process. When an event |
|
1986 occurs, the TRequestStatus is completed. |
|
1987 |
|
1988 @pre Debug Agent must be connected to the debug security server |
|
1989 @pre Debug Agent must have called AttachAll. |
|
1990 |
|
1991 Note 1: Events are reported on a FIFO basis |
|
1992 |
|
1993 Note 2: All the parameters must remain in scope until either CancelGetEvent is called, or |
|
1994 until the request is completed. In practice, this generally |
|
1995 means these parameters should not be based on the stack, as they may go out of |
|
1996 scope before the call completes. |
|
1997 |
|
1998 Note 3: Errors are signalled by completing aStatus |
|
1999 |
|
2000 @param aStatus Debug Agent request status variable. |
|
2001 @param aEventInfo Descriptor containing a TEventInfo object. |
|
2002 |
|
2003 */ |
|
2004 inline void RSecuritySvrSession::GetEvent(TRequestStatus &aStatus, TDes8& aEventInfo) |
|
2005 { |
|
2006 TIpcArgs args(&KStar, &aEventInfo); |
|
2007 |
|
2008 SendReceive(EDebugServGetEvent, args, aStatus ); |
|
2009 } |
|
2010 |
|
2011 /** |
|
2012 Purpose: |
|
2013 Cancel a previously issued asynchronous RSecuritySvrSession::GetEvent call. |
|
2014 |
|
2015 @pre Debug Agent must be connected to the debug security server |
|
2016 @pre Debug Agent should have called AttachAll and GetEvent |
|
2017 |
|
2018 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2019 */ |
|
2020 inline TInt RSecuritySvrSession::CancelGetEvent() |
|
2021 { |
|
2022 TIpcArgs args(&KStar); |
|
2023 |
|
2024 return SendReceive(EDebugServCancelGetEvent,args); |
|
2025 } |
|
2026 |
|
2027 |
|
2028 /** |
|
2029 Called by a debug agent to request debug privileges for the executable with |
|
2030 file name aExecutableName. |
|
2031 |
|
2032 @param aExecutableName a fully qualified file name of the executable to attach to |
|
2033 @param aPassive if true then the agent has reduced debug rights. |
|
2034 |
|
2035 @return KErrNone if attached successfully, one of the other system wide error |
|
2036 codes otherwise |
|
2037 */ |
|
2038 inline TInt RSecuritySvrSession::AttachExecutable(const TDesC& aExecutableName, TBool aPassive) |
|
2039 { |
|
2040 TIpcArgs args((TInt)aPassive, &aExecutableName); |
|
2041 return SendReceive(EDebugServAttachExecutable, args); |
|
2042 } |
|
2043 |
|
2044 /** |
|
2045 Called by a debug agent to detach from the executable with file |
|
2046 name aExecutableName. |
|
2047 |
|
2048 @param aExecutableName the fully qualified file name of the executable to detach from |
|
2049 |
|
2050 @return KErrNone if detached successfully, one of the other system wide error |
|
2051 codes otherwise |
|
2052 */ |
|
2053 inline TInt RSecuritySvrSession::DetachExecutable(const TDesC& aExecutableName) |
|
2054 { |
|
2055 TIpcArgs args(&aExecutableName); |
|
2056 return SendReceive(EDebugServDetachExecutable, args); |
|
2057 } |
|
2058 |
|
2059 /** |
|
2060 Called by a debug agent to attach to events from all processes |
|
2061 |
|
2062 @return KErrNone if attached successfully, one of the other system wide error |
|
2063 codes otherwise |
|
2064 */ |
|
2065 inline TInt RSecuritySvrSession::AttachAll() |
|
2066 { |
|
2067 return SendReceive(EDebugServAttachAll); |
|
2068 } |
|
2069 |
|
2070 /** |
|
2071 Called by a debug agent to detach from all events from all processes |
|
2072 |
|
2073 @return KErrNone if detached successfully, one of the other system wide error |
|
2074 codes otherwise |
|
2075 */ |
|
2076 inline TInt RSecuritySvrSession::DetachAll() |
|
2077 { |
|
2078 return SendReceive(EDebugServDetachAll); |
|
2079 } |
|
2080 |
|
2081 /** |
|
2082 Get buffer size required to contain Functionality text block. |
|
2083 |
|
2084 @see in-source documentation in rm_debug_api.h |
|
2085 |
|
2086 @param aBufSize function will fill this with the required buffer size |
|
2087 |
|
2088 @return KErrNone if the call succeeded, or one of the other system wide error |
|
2089 codes if the call failed |
|
2090 */ |
|
2091 inline TInt RSecuritySvrSession::GetDebugFunctionalityBufSize(TUint32 *aBufSize) |
|
2092 { |
|
2093 TInt res = KErrNone; |
|
2094 |
|
2095 TPtr8 stuff((TUint8*)aBufSize,4, 4); |
|
2096 |
|
2097 TIpcArgs args(&stuff); |
|
2098 |
|
2099 res = SendReceive(EDebugServGetDebugFunctionalityBufSize, args); |
|
2100 |
|
2101 return res; |
|
2102 } |
|
2103 |
|
2104 /** |
|
2105 Get debug functionality text block and place it into aBuffer. |
|
2106 |
|
2107 The debug functionality block (DFBlock) is used to provide information about the functionality |
|
2108 (i.e. features) which are supported by the rm_debug.ldd device driver. |
|
2109 |
|
2110 Calling this function with a suitably sized buffer aBuffer will result in the debug |
|
2111 functionality information being stored in aBuffer. The necessary size of aBuffer can |
|
2112 be determined by calling DebugFunctionalityBufSize(). |
|
2113 |
|
2114 The format of the DFBlock is: |
|
2115 |
|
2116 @code |
|
2117 Sub-block 0 |
|
2118 Sub-block 1 |
|
2119 ... |
|
2120 Sub-block N-1 |
|
2121 @endcode |
|
2122 |
|
2123 The data which will be returned by a call to GetDebugFunctionality() is constant so is |
|
2124 guaranteed to fit exactly into the aBuffer allocated, assuming that the size of aBuffer |
|
2125 corresponds to the value returned from GetDebugFunctionalityBufSize(). |
|
2126 |
|
2127 Each sub-block is composed of a TTagHeader object followed by a C-style array of TTag objects. |
|
2128 The sub-block contains information about a particular aspect of the debug sub-system, for example |
|
2129 information about the manner in which memory can be accessed. |
|
2130 The TTagHeader is comprised of an identifier which determines the type of data |
|
2131 it contains, together with the number of TTag elements in the array following the TTagHeader. |
|
2132 Each TTag in a sub-block has a unique ID, stored in the TTag::iTagId member variable. |
|
2133 |
|
2134 The only sub-block that is guaranteed to exist has TTagHeader::iTagHdrId = ETagHeaderIdCore, all other |
|
2135 sub-blocks are optional. The ETagHeaderIdCore sub-block is the first sub-block within the DFBlock. |
|
2136 Other sub-blocks may appear in any order after the ETagHeaderIdCore sub-block. |
|
2137 |
|
2138 The following is a diagrammatic representation of a sub-block the DFBlock: |
|
2139 |
|
2140 @code |
|
2141 The HHHH represents the tag header ID of a sub-block (TTagHeader::iTagHdrId) |
|
2142 The NNNN represents the number of TTag elements in the sub-block (TTagHeader::iNumTags) |
|
2143 The IIIIIIII represents the ID of the TTag (TTag::iTagId) |
|
2144 The TTTT represents the type of the TTag (TTag::iType) |
|
2145 The SSSS represents the size of the TTag's associated data (TTag::iSize) |
|
2146 The VVVVVVVV represents the TTag's value (TTag::iValue) |
|
2147 |
|
2148 0xNNNNHHHH TTagHeader element for first sub-block (has N1 TTag elements) |
|
2149 0xIIIIIIII \ |
|
2150 0xSSSSTTTT -- TTag 0 |
|
2151 0xVVVVVVVV / |
|
2152 0xIIIIIIII \ |
|
2153 0xSSSSTTTT -- TTag 1 |
|
2154 0xVVVVVVVV / |
|
2155 ... |
|
2156 0xIIIIIIII \ |
|
2157 0xSSSSTTTT -- TTag N1 - 1 |
|
2158 0xVVVVVVVV / |
|
2159 0xNNNNHHHH TTagHeader element for second sub-block (has N2 TTag elements) |
|
2160 0xIIIIIIII \ |
|
2161 0xSSSSTTTT -- TTag 0 |
|
2162 0xVVVVVVVV / |
|
2163 ... |
|
2164 0xIIIIIIII \ |
|
2165 0xSSSSTTTT -- TTag N2 - 1 |
|
2166 0xVVVVVVVV / |
|
2167 ... |
|
2168 0xNNNNHHHH TTagHeader element for last sub-block (has NX TTag elements) |
|
2169 0xIIIIIIII \ |
|
2170 0xSSSSTTTT -- TTag 0 |
|
2171 0xVVVVVVVV / |
|
2172 ... |
|
2173 0xIIIIIIII \ |
|
2174 0xSSSSTTTT -- TTag NX - 1 |
|
2175 0xVVVVVVVV / |
|
2176 @endcode |
|
2177 |
|
2178 The following example DFBlock contains two sub-blocks (values taken from enums below): |
|
2179 - ETagHeaderIdCore |
|
2180 - ETagHeaderIdMemory |
|
2181 |
|
2182 @code |
|
2183 Binary Meaning Value |
|
2184 |
|
2185 0x000A0000 iTagHdrId, iNumTags ETagHeaderIdCore, ECoreLast |
|
2186 0x00000000 iTagId ECoreEvents |
|
2187 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2188 0x00000001 iValue ETrue |
|
2189 0x00000001 iTagId ECoreStartStop |
|
2190 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2191 0x00000001 iValue ETrue |
|
2192 ... |
|
2193 0x00000008 iTagId ECoreHardware |
|
2194 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2195 0x00000000 iValue EFalse |
|
2196 0x00000009 iTagId ECoreApiConstants |
|
2197 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2198 0x00000001 iValue ETrue |
|
2199 |
|
2200 0x000A0001 iTagHdrId, iNumTags ETagHeaderIdMemory, EMemoryLast |
|
2201 0x00000000 iTagId EMemoryRead |
|
2202 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2203 0x00000001 iValue ETrue |
|
2204 0x00000001 iTagId EMemoryWrite |
|
2205 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2206 0x00000001 iValue ETrue |
|
2207 ... |
|
2208 0x00000008 iTagId EMemoryLE8 |
|
2209 0x00000000 iType, iSize ETagTypeBoolean, 0 |
|
2210 0x00000001 iValue ETrue |
|
2211 0x00000009 iTagId EMemoryMaxBlockSize |
|
2212 0x00000001 iType, iSize ETagTypeTUint32, 0 |
|
2213 0x00004000 iValue 0x4000 |
|
2214 @endcode |
|
2215 |
|
2216 - Debug Agent DFBlock Processing: |
|
2217 |
|
2218 Debug Agents MUST understand and process the ETagHeaderIdCore block. The other |
|
2219 blocks may be ignored if not recognised. Tags within each block may be ignored if |
|
2220 not recognised. |
|
2221 |
|
2222 @pre aBuffer.MaxLength() >= *aBufSize where aBufSize is set by a call to: |
|
2223 RSecuritySvrSession::GetDebugFunctionalityBufSize(TUint32 *aBufSize) |
|
2224 |
|
2225 @param aBuffer buffer to store functionality block in |
|
2226 |
|
2227 @return KErrNone if call succeeded, |
|
2228 KErrNoMemory if temporary memory could not be allocated, |
|
2229 KErrGeneral if debug functionality block could not be accessed |
|
2230 */ |
|
2231 inline TInt RSecuritySvrSession::GetDebugFunctionality(TDes8& aBuffer) |
|
2232 { |
|
2233 TIpcArgs args(&aBuffer); |
|
2234 |
|
2235 TInt res = KErrNone; |
|
2236 |
|
2237 res = SendReceive(EDebugServGetDebugFunctionality, args); |
|
2238 |
|
2239 return res; |
|
2240 } |
|
2241 |
|
2242 /** |
|
2243 Read a block of memory from the target debug thread defined by aThreadId. |
|
2244 |
|
2245 @pre the client should attach to the process containing the target thread |
|
2246 @pre aData.MaxLength() >= aLength |
|
2247 |
|
2248 @param aThreadId thread ID of the thread to read memory from |
|
2249 @param aAddress address to start reading memory from |
|
2250 @param aLength number of bytes of memory to read |
|
2251 @param aData descriptor to read memory into |
|
2252 @param aAccessSize access size for memory reads, default is TAccess::EAccess32 |
|
2253 @param aEndianess interpretation of endianess of target data, default is |
|
2254 TEndianess::EEndLE8 |
|
2255 |
|
2256 @return KErrNone if memory read successfully, or one of the other system wide error codes |
|
2257 */ |
|
2258 inline TInt RSecuritySvrSession::ReadMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData, const TAccess aAccessSize, const TEndianess aEndianess) |
|
2259 { |
|
2260 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
2261 //set up memory info object |
|
2262 TMemoryInfo memoryInfo; |
|
2263 memoryInfo.iAddress = aAddress; |
|
2264 memoryInfo.iSize = aLength; |
|
2265 memoryInfo.iAccess = aAccessSize; |
|
2266 memoryInfo.iEndianess = aEndianess; |
|
2267 |
|
2268 TPckgBuf<TMemoryInfo> pckg(memoryInfo); |
|
2269 |
|
2270 TIpcArgs args(&threadIdPckg, &pckg, &aData); |
|
2271 |
|
2272 return SendReceive(EDebugServReadMemory, args); |
|
2273 } |
|
2274 |
|
2275 /** |
|
2276 Write a block of memory to the target debug thread defined by aThreadId. |
|
2277 |
|
2278 @pre the client should attach non-passively to the process containing the |
|
2279 target thread |
|
2280 |
|
2281 @param aThreadId thread ID of the thread to write memory to |
|
2282 @param aAddress address to start writing memory at |
|
2283 @param aLength number of bytes of memory to write |
|
2284 @param aData descriptor to read memory from |
|
2285 @param aAccessSize access size for memory writes, default is TAccess::EAccess32 |
|
2286 @param aEndianess interpretation of endianess of target data, default is |
|
2287 TEndianess::EEndLE8 |
|
2288 |
|
2289 @return KErrNone if memory written successfully, or one of the other system wide error codes |
|
2290 */ |
|
2291 inline TInt RSecuritySvrSession::WriteMemory(const TThreadId aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData, const TAccess aAccessSize, const TEndianess aEndianess) |
|
2292 { |
|
2293 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
2294 //create memory info object |
|
2295 TMemoryInfo memoryInfo; |
|
2296 memoryInfo.iAddress = aAddress; |
|
2297 memoryInfo.iSize = aLength; |
|
2298 memoryInfo.iAccess = aAccessSize; |
|
2299 memoryInfo.iEndianess = aEndianess; |
|
2300 |
|
2301 TPckgBuf<TMemoryInfo> pckg(memoryInfo); |
|
2302 |
|
2303 TIpcArgs args(&threadIdPckg, &pckg, &aData); |
|
2304 |
|
2305 return SendReceive(EDebugServWriteMemory, args); |
|
2306 } |
|
2307 |
|
2308 /** |
|
2309 Read register values from the thread with thread ID aThreadId. The IDs of the |
|
2310 registers to read are stored as an array of TRegisterInfo objects in |
|
2311 aRegisterIds. If the nth register requested could be read then the value of the |
|
2312 register will be appended to aRegisterValues and EValid stored at |
|
2313 offset n in aRegisterFlags. If the register is supported but could not be read |
|
2314 then EInValid will be stored at offset n in aRegisterFlags and arbitrary data |
|
2315 appended in aRegisterValues. If reading the specified register is not |
|
2316 supported by the kernel then ENotSupported will be stored at offset n in |
|
2317 aRegisterFlags and arbitrary data appended to aRegisterValues. If an unknown |
|
2318 register is specified then EUnknown will be put in aRegisterFlags and |
|
2319 arbitrary data placed in aRegisterValues. |
|
2320 |
|
2321 @pre the client should attach to the process containing the target thread |
|
2322 |
|
2323 @see the register ID format is defined in: |
|
2324 SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc |
|
2325 |
|
2326 @param aThreadId thread ID of the thread to read register values from |
|
2327 @param aRegisterIds descriptor containing array of TFunctionalityRegister defined |
|
2328 register IDs |
|
2329 @param aRegisterValues descriptor to contain register values |
|
2330 @param aRegisterFlags descriptor containing array of TUint8 flags, with values |
|
2331 taken from TRegisterFlag |
|
2332 |
|
2333 @return KErrNone if registers were read successfully, or one of the other system wide error codes |
|
2334 */ |
|
2335 inline TInt RSecuritySvrSession::ReadRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, TDes8& aRegisterValues, TDes8& aRegisterFlags) |
|
2336 { |
|
2337 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
2338 TIpcArgs args(&threadIdPckg, &aRegisterIds, &aRegisterValues, &aRegisterFlags); |
|
2339 |
|
2340 return SendReceive(EDebugServReadRegisters, args); |
|
2341 } |
|
2342 |
|
2343 /** |
|
2344 Write register values to the thread with thread ID aThreadId. The IDs of the |
|
2345 registers to write are stored as an array of TRegisterInfo objects in |
|
2346 aRegisterIds. The values to put in the registers are stored as an array of |
|
2347 objects in aRegisterValues. If the nth register to write could be |
|
2348 written then EValid stored at offset n in aRegisterFlags. If the register is |
|
2349 supported but could not be written then EInValid will be stored at offset n in |
|
2350 aRegisterFlags. If writing to the specified register is not supported by the |
|
2351 kernel then ENotSupported will be stored at offset n in aRegisterFlags. If an |
|
2352 unknown register is specified then EUnknown will be put in aRegisterFlags. |
|
2353 |
|
2354 @pre the client should attach non-passively to the process containing the |
|
2355 target thread |
|
2356 |
|
2357 @see the register ID format is defined in: |
|
2358 SGL.TS0028.027 - Symbian Core Dump File Format v1.0.doc |
|
2359 |
|
2360 @param aThreadId thread ID of the thread to write register values to |
|
2361 @param aRegisterIds descriptor containing array of TFunctionalityRegister defined |
|
2362 register IDs |
|
2363 @param aRegisterValues descriptor containing array of register values |
|
2364 @param aRegisterFlags descriptor containing array of TUint8 flags, with values |
|
2365 taken from TRegisterFlag |
|
2366 |
|
2367 @return KErrNone if registers were written successfully, or one of the other system wide error codes |
|
2368 */ |
|
2369 inline TInt RSecuritySvrSession::WriteRegisters(const TThreadId aThreadId, const TDesC8& aRegisterIds, const TDesC8& aRegisterValues, TDes8& aRegisterFlags) |
|
2370 { |
|
2371 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
2372 TIpcArgs args(&threadIdPckg, &aRegisterIds, &aRegisterValues, &aRegisterFlags); |
|
2373 |
|
2374 return SendReceive(EDebugServWriteRegisters, args); |
|
2375 } |
|
2376 |
|
2377 /** |
|
2378 Purpose: |
|
2379 Set the requisite actions to be taken when a particular event occurs. |
|
2380 The events are defined in Debug::TEventType and the |
|
2381 actions are defined in Debug::TKernelEventAction. |
|
2382 |
|
2383 The default action for all events is EActionIgnore. |
|
2384 |
|
2385 @pre Debug Agent must be connected to the debug security server |
|
2386 @pre Debug Agent must be attached to the executable specified by aExecutableName. |
|
2387 |
|
2388 Note: Event actions are on a per-executable basis. This is |
|
2389 to ensure that events such as EEventStartThread are notified to the Debug |
|
2390 Agent, even though the debug agent cannot be aware of the existence |
|
2391 of a new thread at the time the event occurs. |
|
2392 |
|
2393 @param aExecutableName The name of the executable to which the Debug Agent is attached. |
|
2394 @param aEvent A TEventType enum defined in rm_debug_api.h:Debug::TEventType |
|
2395 @param aEventAction Any TKernelEventAction permitted by the DFBlock. |
|
2396 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2397 */ |
|
2398 inline TInt RSecuritySvrSession::SetEventAction(const TDesC& aExecutableName, TEventType aEvent, TKernelEventAction aEventAction) |
|
2399 { |
|
2400 TInt res = KErrNone; |
|
2401 |
|
2402 TIpcArgs args(&aExecutableName,aEvent,aEventAction); |
|
2403 |
|
2404 res = SendReceive(EDebugServSetEventAction, args); |
|
2405 |
|
2406 return res; |
|
2407 } |
|
2408 |
|
2409 /** |
|
2410 Purpose: |
|
2411 Set the requisite actions to be taken when a particular event occurs that is not |
|
2412 associated with any particular process or executable. |
|
2413 |
|
2414 The events are defined in Debug::TEventType and the |
|
2415 actions are defined in Debug::TKernelEventAction. |
|
2416 |
|
2417 The default action for all events is EActionIgnore. |
|
2418 |
|
2419 @pre Debug Agent must be connected to the debug security server |
|
2420 @pre Debug Agent must have called AttachAll. |
|
2421 |
|
2422 @param aEvent A TEventType enum defined in rm_debug_api.h:Debug::TEventType |
|
2423 @param aEventAction Any TKernelEventAction permitted by the DFBlock. |
|
2424 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2425 */ |
|
2426 inline TInt RSecuritySvrSession::SetEventAction(TEventType aEvent, TKernelEventAction aEventAction) |
|
2427 { |
|
2428 TInt res = KErrNone; |
|
2429 |
|
2430 TIpcArgs args(&KStar, aEvent, aEventAction); |
|
2431 |
|
2432 res = SendReceive(EDebugServSetEventAction, args); |
|
2433 |
|
2434 return res; |
|
2435 } |
|
2436 |
|
2437 /** |
|
2438 Returns a global listing corresponding to the type specified as aListId. The structure |
|
2439 of the returned data depends on the value of aListId, see TListId for details. |
|
2440 If aListData is not large enough to contain the listings data then |
|
2441 the necessary buffer size is stored in aDataSize and the function returns |
|
2442 KErrTooBig. In this case the contents of aListData will not contain useful data. |
|
2443 |
|
2444 Note that if the aListData buffer was too small to hold the data then the value |
|
2445 returned as aDataSize corresponds to the size of the data at that particular |
|
2446 instance. The size of the data will vary over time, for example the thread list |
|
2447 will increase and decrease in size as threads are created and destroyed, so |
|
2448 re-requesting data with a buffer with max length aDataSize will not necessarily |
|
2449 succeed if a list has increased in size between the two calls. |
|
2450 |
|
2451 @see TListId |
|
2452 |
|
2453 @param aListId enum from TListId signifying which type of listing to return |
|
2454 @param aListData buffer provided by the debug agent in which data can be returned by the debug system |
|
2455 @param aDataSize if aListData was not large enough to contain the requested |
|
2456 data then the necessary buffer size is stored in aDataSize. If aListData |
|
2457 was large enough then the value of aDataSize is the length of aListData |
|
2458 |
|
2459 @return KErrNone if data was returned successfully, |
|
2460 KErrTooBig if aListData is too small to hold the data, |
|
2461 one of the other system-wide error codes |
|
2462 */ |
|
2463 inline TInt RSecuritySvrSession::GetList(const TListId aListId, TDes8& aListData, TUint32& aDataSize) |
|
2464 { |
|
2465 //second argument of ETrue implies a global listing |
|
2466 TListDetails info(aListId, EScopeGlobal); |
|
2467 TPtr8 infoBuf((TUint8*)&info, sizeof(TListDetails), sizeof(TListDetails)); |
|
2468 TPtr8 dataSizeBuf((TUint8*)&aDataSize, sizeof(TUint32), sizeof(TUint32)); |
|
2469 TIpcArgs args(&infoBuf, &aListData, &dataSizeBuf); |
|
2470 return SendReceive(EDebugServGetList, args); |
|
2471 } |
|
2472 |
|
2473 /** |
|
2474 Returns a thread-specific listing corresponding to the type specified as aListId. The structure |
|
2475 of the returned data depends on the value of aListId, see TListId for details. |
|
2476 If aListData is not large enough to contain the listings data then |
|
2477 the necessary buffer size is stored in aDataSize and the function returns |
|
2478 KErrTooBig. In this case the contents of aListData will not contain useful data. |
|
2479 |
|
2480 Note that if the aListData buffer is too small to hold the data then the value |
|
2481 returned as aDataSize corresponds to the size of the data at that particular |
|
2482 instant. The size of the data will vary over time, for example the thread list |
|
2483 will increase and decrease in size as threads are created and destroyed, so |
|
2484 re-requesting data with a buffer with max length aDataSize will not necessarily |
|
2485 succeed if a list has increased in size between the two calls. |
|
2486 |
|
2487 @see TListId |
|
2488 |
|
2489 @param aThreadId thread to return the listing for |
|
2490 @param aListId member of TListId signifying which type of listing to return |
|
2491 @param aListData buffer provided by the debug agent in which data can be returned by the debug system. |
|
2492 @param aDataSize if aListData was not large enough to contain the requested |
|
2493 data then the necessary buffer size is stored in aDataSize. If aListData |
|
2494 was large enough then the value of aDataSize is the length of aListData |
|
2495 |
|
2496 @return KErrNone if data was returned successfully, |
|
2497 KErrTooBig if aListData is too small to hold the data, |
|
2498 one of the other system-wide error codes |
|
2499 */ |
|
2500 inline TInt RSecuritySvrSession::GetList(const TThreadId aThreadId, const TListId aListId, TDes8& aListData, TUint32& aDataSize) |
|
2501 { |
|
2502 TListDetails info(aListId, EScopeThreadSpecific, aThreadId.Id()); |
|
2503 TPtr8 infoBuf((TUint8*)&info, sizeof(TListDetails), sizeof(TListDetails)); |
|
2504 TPtr8 dataSizeBuf((TUint8*)&aDataSize, sizeof(TUint32), sizeof(TUint32)); |
|
2505 TIpcArgs args(&infoBuf, &aListData, &dataSizeBuf); |
|
2506 return SendReceive(EDebugServGetList, args); |
|
2507 } |
|
2508 |
|
2509 /** |
|
2510 Returns a process-specific listing corresponding to the type specified as aListId. The structure |
|
2511 of the returned data depends on the value of aListId, see TListId for details. |
|
2512 If aListData is not large enough to contain the listings data then |
|
2513 the necessary buffer size is stored in aDataSize and the function returns |
|
2514 KErrTooBig. In this case the contents of aListData will not contain useful data. |
|
2515 |
|
2516 Note that if the aListData buffer is too small to hold the data then the value |
|
2517 returned as aDataSize corresponds to the size of the data at that particular |
|
2518 instant. The size of the data will vary over time, for example the thread list |
|
2519 will increase and decrease in size as threads are created and destroyed, so |
|
2520 re-requesting data with a buffer with max length aDataSize will not necessarily |
|
2521 succeed if a list has increased in size between the two calls. |
|
2522 |
|
2523 @see TListId |
|
2524 |
|
2525 @param aProcessId process to return the listing for |
|
2526 @param aListId member of TListId signifying which type of listing to return |
|
2527 @param aListData buffer provided by the debug agent in which data can be returned by the debug system. |
|
2528 @param aDataSize if aListData was not large enough to contain the requested |
|
2529 data then the necessary buffer size is stored in aDataSize. If aListData |
|
2530 was large enough then the value of aDataSize is the length of aListData |
|
2531 |
|
2532 @return KErrNone if data was returned successfully, |
|
2533 KErrTooBig if aListData is too small to hold the data, |
|
2534 one of the other system-wide error codes |
|
2535 */ |
|
2536 inline TInt RSecuritySvrSession::GetList(const TProcessId aProcessId, const TListId aListId, TDes8& aListData, TUint32& aDataSize) |
|
2537 { |
|
2538 TListDetails info(aListId, EScopeProcessSpecific, aProcessId.Id()); |
|
2539 TPtr8 infoBuf((TUint8*)&info, sizeof(TListDetails), sizeof(TListDetails)); |
|
2540 TPtr8 dataSizeBuf((TUint8*)&aDataSize, sizeof(TUint32), sizeof(TUint32)); |
|
2541 TIpcArgs args(&infoBuf, &aListData, &dataSizeBuf); |
|
2542 return SendReceive(EDebugServGetList, args); |
|
2543 } |
|
2544 |
|
2545 /** |
|
2546 Purpose: |
|
2547 Step one or more CPU instructions in the specified thread from the current PC. |
|
2548 |
|
2549 @pre Debug Agent must be connected to the debug security server |
|
2550 @pre Debug Agent must be attached to a process. |
|
2551 @pre The thread being stepped must be suspended by the Debug Agent. |
|
2552 |
|
2553 @param aThreadId the id of the thread which is to be stepped |
|
2554 @param aNumSteps how many machine-level instructions are to be stepped. |
|
2555 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2556 */ |
|
2557 inline TInt RSecuritySvrSession::Step(const TThreadId aThreadId, const TUint32 aNumSteps) |
|
2558 { |
|
2559 TPckgBuf<TThreadId> threadIdPckg(aThreadId); |
|
2560 TInt res = KErrNone; |
|
2561 |
|
2562 TIpcArgs args(&threadIdPckg,aNumSteps); |
|
2563 |
|
2564 res = SendReceive(EDebugServStep,args); |
|
2565 |
|
2566 return res; |
|
2567 } |
|
2568 |
|
2569 /** |
|
2570 Purpose: |
|
2571 Kill the specified process with the supplied reason. Reason codes are equivalent |
|
2572 to those in RProcess.Kill(). |
|
2573 |
|
2574 @pre Debug Agent must be connected to the debug security server |
|
2575 @pre Debug Agent must be attached to a process. |
|
2576 |
|
2577 @param aProcessId the id of the process which is to be killed |
|
2578 @param aReason The reason to be associated with the ending of this process |
|
2579 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2580 */ |
|
2581 inline TInt RSecuritySvrSession::KillProcess(const TProcessId aProcessId, const TInt aReason) |
|
2582 { |
|
2583 TPckgBuf<TProcessId> processIdPckg(aProcessId); |
|
2584 TInt res = KErrNone; |
|
2585 |
|
2586 TIpcArgs args(&processIdPckg,aReason); |
|
2587 |
|
2588 res = SendReceive(EDebugServKillProcess,args); |
|
2589 |
|
2590 return res; |
|
2591 } |
|
2592 |
|
2593 /** |
|
2594 Purpose |
|
2595 Method to read data from the crash flash |
|
2596 |
|
2597 @pre aData buffer to retrieve the data from the crash flash |
|
2598 @pre aDataSize Size of the data |
|
2599 |
|
2600 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2601 */ |
|
2602 inline TInt RSecuritySvrSession::ReadCrashLog(const TUint32 aPos, TDes8& aData, const TUint32 aDataSize) |
|
2603 { |
|
2604 TIpcArgs args(aPos, &aData, aDataSize); |
|
2605 TInt res = SendReceive(EDebugServReadCrashFlash,args); |
|
2606 return res; |
|
2607 } |
|
2608 |
|
2609 /** |
|
2610 * @internalTechnology |
|
2611 * @prototype |
|
2612 * |
|
2613 Purpose: |
|
2614 Method to write the crash flash config |
|
2615 |
|
2616 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2617 */ |
|
2618 inline TInt RSecuritySvrSession::WriteCrashConfig(const TUint32 aPos, const TDesC8& aBuffer, TUint32& aSize) |
|
2619 { |
|
2620 TPtr8 sizePtr((TUint8*)&aSize,4, 4); |
|
2621 TIpcArgs args(aPos, &aBuffer, &sizePtr); |
|
2622 TInt res = SendReceive(EDebugServWriteCrashFlash, args); |
|
2623 return res; |
|
2624 } |
|
2625 /** |
|
2626 Purpose: |
|
2627 Method to erase a block in the crash flash |
|
2628 |
|
2629 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2630 */ |
|
2631 inline TInt RSecuritySvrSession::EraseCrashLog(const TUint32 aPos, const TUint32 aBlockNumber) |
|
2632 { |
|
2633 TIpcArgs args(aPos, aBlockNumber); |
|
2634 TInt res = SendReceive(EDebugServEraseCrashFlash, args); |
|
2635 return res; |
|
2636 } |
|
2637 |
|
2638 /** |
|
2639 Purpose: |
|
2640 Method to erase entire flash partition |
|
2641 |
|
2642 @return Any error which may be returned by RSessionBase::SendReceive() |
|
2643 */ |
|
2644 inline TInt RSecuritySvrSession::EraseCrashFlashPartition() |
|
2645 { |
|
2646 TInt res = SendReceive(EDebugServEraseEntireCrashFlash); |
|
2647 return res; |
|
2648 } |
|
2649 |
|
2650 } // end of Debug namespace declaration |
|
2651 |
|
2652 #endif // #ifndef __KERNEL_MODE__ |
|
2653 |
|
2654 #endif // RM_DEBUG_API_H |
|
2655 |
|
2656 |
|
2657 |