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