1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 @released |
|
22 */ |
|
23 |
|
24 #ifndef __RM_DEBUG_KERNELDRIVER_H__ |
|
25 #define __RM_DEBUG_KERNELDRIVER_H__ |
|
26 |
|
27 #include <rm_debug_api.h> |
|
28 |
|
29 /** |
|
30 Used to store a value read from or written to an ARM register |
|
31 */ |
|
32 typedef TUint32 T4ByteRegisterValue; |
|
33 |
|
34 |
|
35 /** |
|
36 Provides static methods for accessing the information stored in a TRegisterInfo |
|
37 object. |
|
38 */ |
|
39 class Register |
|
40 { |
|
41 public: |
|
42 static TBool IsCoreReg(const Debug::TRegisterInfo aRegister); |
|
43 static TBool IsCoproReg(const Debug::TRegisterInfo aRegister); |
|
44 static TUint32 GetCoreRegId(const Debug::TRegisterInfo aRegister); |
|
45 static TUint32 GetCRm(const Debug::TRegisterInfo aRegister); |
|
46 static TUint32 GetCRn(const Debug::TRegisterInfo aRegister); |
|
47 static TUint32 GetOpcode1(const Debug::TRegisterInfo aRegister); |
|
48 static TUint32 GetOpcode2(const Debug::TRegisterInfo aRegister); |
|
49 static TUint32 GetCoproNum(const Debug::TRegisterInfo aRegister); |
|
50 }; |
|
51 |
|
52 /** |
|
53 Identify whether aRegister is a core register |
|
54 @param aRegister register ID to analyse |
|
55 @return ETrue if core register, EFalse otherwise |
|
56 */ |
|
57 inline TBool Register::IsCoreReg(const Debug::TRegisterInfo aRegister) |
|
58 { |
|
59 return ((aRegister & 0xff) == 0x0); |
|
60 } |
|
61 |
|
62 /** |
|
63 Identify whether aRegister is a coprocessor register |
|
64 @param aRegister register ID to analyse |
|
65 @return ETrue if coprocessor register, EFalse otherwise |
|
66 */ |
|
67 inline TBool Register::IsCoproReg(const Debug::TRegisterInfo aRegister) |
|
68 { |
|
69 return ((aRegister & 0xff) == 0x1); |
|
70 } |
|
71 |
|
72 /** |
|
73 Get the ID of the core register |
|
74 @param aRegister register ID to analyse |
|
75 @return ID of the core register |
|
76 */ |
|
77 inline TUint32 Register::GetCoreRegId(const Debug::TRegisterInfo aRegister) |
|
78 { |
|
79 return ((aRegister >> 8) & 0xff); |
|
80 } |
|
81 |
|
82 /** |
|
83 Get the CRm value of a coprocessor register |
|
84 @param aRegister register ID to analyse |
|
85 @return the CRm value of a coprocessor register |
|
86 */ |
|
87 inline TUint32 Register::GetCRm(const Debug::TRegisterInfo aRegister) |
|
88 { |
|
89 return ((aRegister >> 16) & 0xf); |
|
90 } |
|
91 |
|
92 /** |
|
93 Get the CRm value of a coprocessor register |
|
94 @param aRegister register ID to analyse |
|
95 @return the CRm value of a coprocessor register |
|
96 */ |
|
97 inline TUint32 Register::GetCRn(const Debug::TRegisterInfo aRegister) |
|
98 { |
|
99 return ((aRegister >> 20) & 0xf); |
|
100 } |
|
101 |
|
102 /** |
|
103 Get the Opcode1 value of a coprocessor register |
|
104 @param aRegister register ID to analyse |
|
105 @return the Opcode1 value of a coprocessor register |
|
106 */ |
|
107 inline TUint32 Register::GetOpcode1(const Debug::TRegisterInfo aRegister) |
|
108 { |
|
109 return ((aRegister >> 24) & 0x8); |
|
110 } |
|
111 |
|
112 /** |
|
113 Get the Opcode2 value of a coprocessor register |
|
114 @param aRegister register ID to analyse |
|
115 @return the Opcode2 value of a coprocessor register |
|
116 */ |
|
117 inline TUint32 Register::GetOpcode2(const Debug::TRegisterInfo aRegister) |
|
118 { |
|
119 return ((aRegister >> 27) & 0x8); |
|
120 } |
|
121 |
|
122 /** |
|
123 Get the coprocessor number of a coprocessor register |
|
124 @param aRegister register ID to analyse |
|
125 @return the coprocessor number of a coprocessor register |
|
126 */ |
|
127 inline TUint32 Register::GetCoproNum(const Debug::TRegisterInfo aRegister) |
|
128 { |
|
129 return ((aRegister >> 8) & 0xff); |
|
130 } |
|
131 |
|
132 // |
|
133 // class TCapsRM_DebugDriver |
|
134 // |
|
135 class TCapsRM_DebugDriver |
|
136 { |
|
137 public: |
|
138 TVersion iVersion; |
|
139 }; |
|
140 |
|
141 /** |
|
142 Stores listings information for passing between the DSS and the kernel driver |
|
143 */ |
|
144 class TListInformation |
|
145 { |
|
146 public: |
|
147 inline TListInformation(const Debug::TListId aType=(Debug::TListId)NULL, const Debug::TListScope aListScope=(Debug::TListScope)NULL, TDes8* aBuffer=NULL, TUint32* aDataSize=NULL, TUint64 aTargetId=0) |
|
148 : iType(aType), |
|
149 iListScope(aListScope), |
|
150 iBuffer(aBuffer), |
|
151 iDataSize(aDataSize), |
|
152 iTargetId(aTargetId) {}; |
|
153 public: |
|
154 Debug::TListId iType; |
|
155 Debug::TListScope iListScope; |
|
156 TDes8* iBuffer; |
|
157 TUint32* iDataSize; |
|
158 TUint64 iTargetId; |
|
159 }; |
|
160 |
|
161 /** |
|
162 Data structure to hold information to the crash flash |
|
163 (Possibly: Could be expanded to hold on configuration data too) |
|
164 */ |
|
165 class TFlashInfo |
|
166 { |
|
167 public: |
|
168 inline TFlashInfo(TUint32 aPos, TUint32* aSize, TDes8* aData) |
|
169 :iPos(aPos), |
|
170 iSize(aSize), |
|
171 iData(aData){}; |
|
172 public: |
|
173 TUint32 iPos; |
|
174 TUint32* iSize; |
|
175 TDes8* iData; |
|
176 }; |
|
177 // |
|
178 // class TRM_DebugMemoryInfo |
|
179 // |
|
180 class TRM_DebugMemoryInfo |
|
181 { |
|
182 public: |
|
183 |
|
184 inline TRM_DebugMemoryInfo(const TUint32 aAddress, const TUint32 aLength, TDesC8 *aData) |
|
185 : iAddress(aAddress), |
|
186 iLength(aLength), |
|
187 iData(aData) {}; |
|
188 |
|
189 public: |
|
190 |
|
191 TUint32 iAddress; |
|
192 TUint32 iLength; |
|
193 TDesC8* iData; |
|
194 }; |
|
195 |
|
196 |
|
197 /** |
|
198 @deprecated |
|
199 This class is only used by TRK phase 1 functions. |
|
200 |
|
201 @see TRM_DebugRegisterInformation which offers similar storage suitable for use |
|
202 with the TRK pahse 2 API. |
|
203 */ |
|
204 class TRM_DebugRegisterInfo |
|
205 { |
|
206 public: |
|
207 |
|
208 inline TRM_DebugRegisterInfo(const TInt16 aFirstRegister, const TInt16 aLastRegister, TDesC8 *aValues) |
|
209 : iFirstRegister(aFirstRegister), |
|
210 iLastRegister(aLastRegister), |
|
211 iValues(aValues) {}; |
|
212 |
|
213 public: |
|
214 |
|
215 TInt16 iFirstRegister; |
|
216 TInt16 iLastRegister; |
|
217 TDesC8* iValues; |
|
218 }; |
|
219 |
|
220 /** |
|
221 Structure used to store information about registers |
|
222 */ |
|
223 class TRM_DebugRegisterInformation |
|
224 { |
|
225 public: |
|
226 |
|
227 inline TRM_DebugRegisterInformation(const TDes8 *aRegisterIds=NULL, TDes8 *aRegisterValues=NULL, TDes8 *aRegisterFlags=NULL) |
|
228 : iRegisterIds(aRegisterIds), |
|
229 iRegisterValues(aRegisterValues), |
|
230 iRegisterFlags(aRegisterFlags) {}; |
|
231 |
|
232 public: |
|
233 |
|
234 const TDes8* iRegisterIds; |
|
235 TDes8* iRegisterValues; |
|
236 TDes8* iRegisterFlags; |
|
237 }; |
|
238 |
|
239 // |
|
240 // class TRM_DebugTaskInfo |
|
241 // |
|
242 class TRM_DebugTaskInfo |
|
243 { |
|
244 public: |
|
245 |
|
246 inline TRM_DebugTaskInfo(TUint32 aOtherId) |
|
247 : iId(0), |
|
248 iOtherId(aOtherId), |
|
249 iPriority(0) { iName.FillZ(); }; |
|
250 |
|
251 public: |
|
252 |
|
253 TUint32 iId; |
|
254 TUint32 iOtherId; |
|
255 TUint32 iPriority; |
|
256 TBuf8<KMaxName> iName; |
|
257 }; |
|
258 |
|
259 // |
|
260 // class TRM_DebugStepInfo |
|
261 // |
|
262 class TRM_DebugStepInfo |
|
263 { |
|
264 public: |
|
265 |
|
266 inline TRM_DebugStepInfo(const TUint32 aStartAddress, const TUint32 aStopAddress, const TBool aStepInto) |
|
267 : iStartAddress(aStartAddress), |
|
268 iStopAddress(aStopAddress), |
|
269 iStepInto(aStepInto) {}; |
|
270 |
|
271 public: |
|
272 |
|
273 TUint32 iStartAddress; |
|
274 TUint32 iStopAddress; |
|
275 TBool iStepInto; |
|
276 }; |
|
277 |
|
278 |
|
279 // |
|
280 // class TRM_DebugDriverInfo |
|
281 // |
|
282 class TRM_DebugDriverInfo |
|
283 { |
|
284 public: |
|
285 |
|
286 TUint32 iPanic1Address; |
|
287 TUint32 iPanic2Address; |
|
288 TUint32 iException1Address; |
|
289 TUint32 iException2Address; |
|
290 TUint32 iLibraryLoadedAddress; |
|
291 TUint32 iUserLibraryEnd; |
|
292 }; |
|
293 |
|
294 |
|
295 // |
|
296 // class TRM_DebugProcessInfo |
|
297 // |
|
298 class TRM_DebugProcessInfo |
|
299 { |
|
300 public: |
|
301 |
|
302 inline TRM_DebugProcessInfo(TUint32 *aCodeAddress, TUint32 *aDataAddress) |
|
303 : iCodeAddress(aCodeAddress), |
|
304 iDataAddress(aDataAddress) {}; |
|
305 |
|
306 public: |
|
307 |
|
308 TUint32* iCodeAddress; |
|
309 TUint32* iDataAddress; |
|
310 }; |
|
311 |
|
312 // |
|
313 // class TRM_DebugEventActionInfo |
|
314 // |
|
315 class TRM_DebugEventActionInfo |
|
316 { |
|
317 public: |
|
318 inline TRM_DebugEventActionInfo(TUint32 aEvent, TUint32 aAction, TUint64 aAgentId) |
|
319 : iEvent(aEvent), |
|
320 iAction(aAction), |
|
321 iAgentId(aAgentId) {}; |
|
322 public: |
|
323 TUint32 iEvent; |
|
324 TUint32 iAction; |
|
325 TUint64 iAgentId; |
|
326 }; |
|
327 |
|
328 // |
|
329 // class TRM_DebugEventInfo |
|
330 // |
|
331 class TRM_DebugEventInfo |
|
332 { |
|
333 public: |
|
334 inline TRM_DebugEventInfo(TDesC8& aProcessName, TUint32& aBufSize) |
|
335 : iProcessName(aProcessName), |
|
336 iBufSize(aBufSize) {}; |
|
337 |
|
338 public: |
|
339 TDesC8& iProcessName; |
|
340 TUint32& iBufSize; |
|
341 }; |
|
342 |
|
343 // |
|
344 // class TRMD_DebugAgentId |
|
345 // |
|
346 class TRM_DebugAgentId |
|
347 { |
|
348 public: |
|
349 inline TRM_DebugAgentId(TUint64 aAgentId) |
|
350 : iAgentId(aAgentId) {}; |
|
351 |
|
352 public: |
|
353 TUint64 iAgentId; |
|
354 }; |
|
355 |
|
356 // |
|
357 // Class TRMD_DebugCancelInfo |
|
358 // |
|
359 class TRMD_DebugCancelInfo |
|
360 { |
|
361 public: |
|
362 inline TRMD_DebugCancelInfo(TUint32 aCancelRequest,TDesC8& aProcessName, TUint64 aAgentId) |
|
363 : iCancelRequest(aCancelRequest), |
|
364 iProcessName(aProcessName), |
|
365 iAgentId(aAgentId) {}; |
|
366 |
|
367 inline TRMD_DebugCancelInfo(void) |
|
368 : iCancelRequest(0), |
|
369 iAgentId(0) |
|
370 { |
|
371 }; |
|
372 |
|
373 public: |
|
374 TUint32 iCancelRequest; |
|
375 TBuf8<KMaxName> iProcessName; |
|
376 TUint64 iAgentId; |
|
377 }; |
|
378 |
|
379 class TEventMetaData |
|
380 { |
|
381 public: |
|
382 TBuf8<KMaxName> iTargetProcessName; |
|
383 TUint64 iDebugAgentProcessId; |
|
384 }; |
|
385 |
|
386 /** |
|
387 @internalComponent |
|
388 */ |
|
389 class TSetBreakInfo |
|
390 { |
|
391 public: |
|
392 |
|
393 inline TSetBreakInfo(Debug::TBreakId* aBreakId, |
|
394 TUint64 aId,\ |
|
395 TUint32 aAddress,\ |
|
396 Debug::TArchitectureMode aMode, |
|
397 TBool aThreadSpecific) |
|
398 : iBreakId(aBreakId), |
|
399 iId(aId), |
|
400 iAddress(aAddress), |
|
401 iMode(aMode), |
|
402 iThreadSpecific(aThreadSpecific) {}; |
|
403 |
|
404 inline TSetBreakInfo(void) |
|
405 : iBreakId((Debug::TBreakId*)0), |
|
406 iId(0), |
|
407 iAddress(0), |
|
408 iMode(Debug::EArmMode), |
|
409 iThreadSpecific(ETrue) {}; |
|
410 |
|
411 |
|
412 public: |
|
413 Debug::TBreakId* iBreakId; |
|
414 TUint64 iId; |
|
415 TUint32 iAddress; |
|
416 Debug::TArchitectureMode iMode; |
|
417 TBool iThreadSpecific; |
|
418 }; |
|
419 |
|
420 /** |
|
421 @internalComponent |
|
422 */ |
|
423 class TModifyBreakInfo |
|
424 { |
|
425 public: |
|
426 |
|
427 inline TModifyBreakInfo(Debug::TBreakId aBreakId,\ |
|
428 const TUint64 aThreadId,\ |
|
429 const TUint32 aAddress,\ |
|
430 const Debug::TArchitectureMode aMode) |
|
431 : iBreakId(aBreakId), |
|
432 iThreadId(aThreadId), |
|
433 iAddress(aAddress), |
|
434 iMode(aMode) {}; |
|
435 |
|
436 public: |
|
437 const Debug::TBreakId iBreakId; |
|
438 const TUint64 iThreadId; |
|
439 const TUint32 iAddress; |
|
440 const Debug::TArchitectureMode iMode; |
|
441 }; |
|
442 |
|
443 /** |
|
444 @internalComponent |
|
445 */ |
|
446 class TModifyProcessBreakInfo |
|
447 { |
|
448 public: |
|
449 |
|
450 inline TModifyProcessBreakInfo(Debug::TBreakId aBreakId,\ |
|
451 const TUint64 aProcessId,\ |
|
452 const TUint32 aAddress,\ |
|
453 const Debug::TArchitectureMode aMode) |
|
454 : iBreakId(aBreakId), |
|
455 iProcessId(aProcessId), |
|
456 iAddress(aAddress), |
|
457 iMode(aMode) {}; |
|
458 |
|
459 public: |
|
460 const Debug::TBreakId iBreakId; |
|
461 const TUint64 iProcessId; |
|
462 const TUint32 iAddress; |
|
463 const Debug::TArchitectureMode iMode; |
|
464 }; |
|
465 |
|
466 /** |
|
467 @internalComponent |
|
468 */ |
|
469 class TGetBreakInfo |
|
470 { |
|
471 public: |
|
472 |
|
473 inline TGetBreakInfo(Debug::TBreakId aBreakId,\ |
|
474 TUint64& aId,\ |
|
475 TUint32& aAddress,\ |
|
476 Debug::TArchitectureMode& aMode, |
|
477 TBool& aThreadSpecific) |
|
478 : iBreakId(aBreakId), |
|
479 iId(&aId), |
|
480 iAddress(&aAddress), |
|
481 iMode(&aMode), |
|
482 iThreadSpecific(&aThreadSpecific) {}; |
|
483 |
|
484 inline TGetBreakInfo() |
|
485 : iBreakId((Debug::TBreakId)0), |
|
486 iId((TUint64*)0), |
|
487 iAddress((TUint32*)0), |
|
488 iMode((Debug::TArchitectureMode*)0), |
|
489 iThreadSpecific((TBool*)0) {}; |
|
490 |
|
491 public: |
|
492 const Debug::TBreakId iBreakId; |
|
493 TUint64* iId; |
|
494 TUint32* iAddress; |
|
495 Debug::TArchitectureMode* iMode; |
|
496 TBool* iThreadSpecific; |
|
497 }; |
|
498 |
|
499 // |
|
500 // class RRM_DebugDriver |
|
501 // |
|
502 class RRM_DebugDriver : public RBusLogicalChannel |
|
503 { |
|
504 public: |
|
505 |
|
506 enum TControl |
|
507 { |
|
508 EControlSetBreak = 0, |
|
509 EControlClearBreak, |
|
510 EControlModifyBreak, |
|
511 EControlBreakInfo, |
|
512 EControlSuspendThread, |
|
513 EControlResumeThread, |
|
514 EControlStepRange, |
|
515 EControlReadMemory, |
|
516 EControlWriteMemory, |
|
517 EControlReadRegisters, |
|
518 EControlWriteRegisters, |
|
519 EControlGetStaticLibraryInfo, |
|
520 EControlGetDebugFunctionalityBufSize, |
|
521 EControlGetDebugFunctionality, |
|
522 EControlReadRegistersLegacy, |
|
523 EControlWriteRegistersLegacy, |
|
524 EControlGetMemoryOperationMaxBlockSize, |
|
525 EControlAttachProcess, |
|
526 EControlDetachProcess, |
|
527 EControlDetachAgent, |
|
528 EControlSetEventAction, |
|
529 EControlGetList, |
|
530 EControlStep, |
|
531 EControlIsDebuggable, |
|
532 EControlKillProcess, |
|
533 EControlModifyProcessBreak, |
|
534 }; |
|
535 |
|
536 enum TRequest |
|
537 { |
|
538 ERequestGetEvent=0x0, ERequestGetEventCancel=0x1 |
|
539 }; |
|
540 |
|
541 public: |
|
542 |
|
543 inline TInt Open(const TRM_DebugDriverInfo aDriverInfo); |
|
544 |
|
545 inline TInt SetBreak(Debug::TBreakId &aBreakId,const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aThumbMode ); |
|
546 inline TInt SetProcessBreak(Debug::TBreakId &aBreakId,const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aThumbMode ); |
|
547 |
|
548 inline TInt ClearBreak(const TInt32 aBreakId); |
|
549 |
|
550 inline TInt ModifyBreak(const Debug::TBreakId aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aArchitectureMode ); |
|
551 inline TInt ModifyProcessBreak(const Debug::TBreakId aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aArchitectureMode ); |
|
552 |
|
553 inline TInt BreakInfo(const Debug::TBreakId aBreakId, TUint64& aId, TUint32& aAddress, Debug::TArchitectureMode& aMode, TBool& aThreadSpecific); |
|
554 |
|
555 inline TInt SuspendThread(const TUint32 aThreadId); |
|
556 inline TInt ResumeThread(const TUint32 aThreadId); |
|
557 inline TInt StepRange(const TUint32 aThreadId, const TUint32 aStartAddress, const TUint32 aStopAddress, TBool aStepInto); |
|
558 inline TInt ReadMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData); |
|
559 inline TInt WriteMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData); |
|
560 inline TInt ReadRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, TDes8 &aRegisterValues, TDes8 &aRegisterFlags); |
|
561 inline TInt WriteRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, const TDes8 &aRegisterValues, TDes8 &aRegisterFlags); |
|
562 inline TInt ReadRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDes8 &aValues); |
|
563 inline TInt WriteRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDesC8 &aValues); |
|
564 inline void GetEvent(TDesC8& aProcessName, TUint64 aAgentId, TRequestStatus &aStatus, Debug::TEventInfo &aEventInfo); |
|
565 inline void CancelGetEvent(TDesC8& aProcessName, TUint64 aAgentId); |
|
566 // inline TInt GetProcessInfo(const TInt aIndex, TRM_DebugTaskInfo &aInfo); |
|
567 // inline TInt GetThreadInfo(const TInt aIndex, TRM_DebugTaskInfo &aInfo); |
|
568 inline TInt GetStaticLibraryInfo(const TInt aIndex, Debug::TEventInfo &aInfo); |
|
569 inline TInt GetDebugFunctionalityBufSize(TUint32 &aBufSize); |
|
570 inline TInt GetDebugFunctionality(TDes8& aDebugFunctionality); |
|
571 inline TInt GetMemoryOperationMaxBlockSize(TUint32 &aMaxSize); |
|
572 inline TInt AttachProcess(TDesC8& aProcessName, TUint64 aAgentId); |
|
573 inline TInt DetachProcess(TDesC8& aProcessName, TUint64 aAgentId); |
|
574 inline TInt DetachAgent(TUint64 aAgentId); |
|
575 inline TInt SetEventAction(TDesC8& aProcessName, Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction, TUint64 aAgentId); |
|
576 inline TInt GetList(const Debug::TListId aType, const Debug::TListScope aListScope, const TUint64 aTargetId, const TUint64 aDebugProcessId, TDes8& aBuffer, TUint32& aDataSize); |
|
577 inline TInt Step(const TUint32 aThreadId, const TUint32 aNumSteps); |
|
578 inline TInt IsDebuggable(const TUint32 aProcessId); |
|
579 inline TInt KillProcess(const TUint32 aProcessId, const TInt32 aReason); |
|
580 }; |
|
581 |
|
582 _LIT(KRM_DebugDriverName,"RM Debug Driver"); |
|
583 |
|
584 //priority set equal to that of KDfcThread0Priority defined in e32/kernel/sinit.cpp |
|
585 const TInt KRmDebugDriverThreadPriority = 27; |
|
586 |
|
587 // Version information |
|
588 const TInt KMajorVersionNumber=2; |
|
589 const TInt KMinorVersionNumber=1; |
|
590 const TInt KBuildVersionNumber=0; |
|
591 |
|
592 |
|
593 inline TInt RRM_DebugDriver::Open(const TRM_DebugDriverInfo aDriverInfo) |
|
594 { |
|
595 TBuf8<32> buf; |
|
596 buf.Append((TUint8*)&aDriverInfo.iPanic1Address, 4); |
|
597 buf.Append((TUint8*)&aDriverInfo.iPanic2Address, 4); |
|
598 buf.Append((TUint8*)&aDriverInfo.iException1Address, 4); |
|
599 buf.Append((TUint8*)&aDriverInfo.iException2Address, 4); |
|
600 buf.Append((TUint8*)&aDriverInfo.iLibraryLoadedAddress, 4); |
|
601 buf.Append((TUint8*)&aDriverInfo.iUserLibraryEnd, 4); |
|
602 |
|
603 #ifdef EKA2 |
|
604 return DoCreate(KRM_DebugDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), KNullUnit, NULL, &buf); |
|
605 #else |
|
606 return DoCreate(KRM_DebugDriverName, TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildVersionNumber), NULL, KNullUnit, NULL, &buf); |
|
607 #endif |
|
608 } |
|
609 |
|
610 inline TInt RRM_DebugDriver::SetBreak(Debug::TBreakId &aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aMode ) |
|
611 { |
|
612 TSetBreakInfo info(&aBreakId, aThreadId, aAddress, aMode, ETrue); |
|
613 return DoSvControl(EControlSetBreak, reinterpret_cast<TAny*>(&info),0); |
|
614 } |
|
615 inline TInt RRM_DebugDriver::SetProcessBreak(Debug::TBreakId &aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aMode ) |
|
616 { |
|
617 TSetBreakInfo info(&aBreakId, aProcessId, aAddress, aMode, EFalse); |
|
618 return DoSvControl(EControlSetBreak, reinterpret_cast<TAny*>(&info),0); |
|
619 } |
|
620 |
|
621 inline TInt RRM_DebugDriver::ClearBreak(const Debug::TBreakId aBreakId) |
|
622 { |
|
623 return DoSvControl(EControlClearBreak, reinterpret_cast<TAny*>(aBreakId), 0); |
|
624 } |
|
625 |
|
626 inline TInt RRM_DebugDriver::ModifyBreak(const Debug::TBreakId aBreakId, const TUint32 aThreadId, const TUint32 aAddress, const Debug::TArchitectureMode aMode) |
|
627 { |
|
628 TModifyBreakInfo info(aBreakId, aThreadId, aAddress, aMode); |
|
629 return DoControl(EControlModifyBreak, reinterpret_cast<TAny*>(&info), 0); |
|
630 } |
|
631 |
|
632 inline TInt RRM_DebugDriver::ModifyProcessBreak(const Debug::TBreakId aBreakId, const TUint32 aProcessId, const TUint32 aAddress, const Debug::TArchitectureMode aMode) |
|
633 { |
|
634 TModifyProcessBreakInfo info(aBreakId, aProcessId, aAddress, aMode); |
|
635 return DoControl(EControlModifyProcessBreak, reinterpret_cast<TAny*>(&info), 0); |
|
636 } |
|
637 |
|
638 inline TInt RRM_DebugDriver::BreakInfo(const Debug::TBreakId aBreakId, TUint64& aId, TUint32& aAddress, Debug::TArchitectureMode& aMode, TBool& aThreadSpecific) |
|
639 { |
|
640 TGetBreakInfo info(aBreakId, aId, aAddress, aMode, aThreadSpecific); |
|
641 return DoControl(EControlBreakInfo, reinterpret_cast<TAny*>(&info), 0); |
|
642 } |
|
643 |
|
644 inline TInt RRM_DebugDriver::SuspendThread(const TUint32 aThreadId) |
|
645 { |
|
646 return DoControl(EControlSuspendThread, reinterpret_cast<TAny*>(aThreadId)); |
|
647 } |
|
648 |
|
649 inline TInt RRM_DebugDriver::ResumeThread(const TUint32 aThreadId) |
|
650 { |
|
651 return DoSvControl(EControlResumeThread, reinterpret_cast<TAny*>(aThreadId)); |
|
652 } |
|
653 |
|
654 inline TInt RRM_DebugDriver::StepRange(const TUint32 aThreadId, const TUint32 aStartAddress, const TUint32 aStopAddress, TBool aStepInto) |
|
655 { |
|
656 TRM_DebugStepInfo info(aStartAddress, aStopAddress, aStepInto); |
|
657 return DoSvControl(EControlStepRange, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
658 } |
|
659 |
|
660 inline TInt RRM_DebugDriver::ReadMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, TDes8 &aData) |
|
661 { |
|
662 TRM_DebugMemoryInfo info(aAddress, aLength, &aData); |
|
663 return DoControl(EControlReadMemory, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
664 } |
|
665 |
|
666 inline TInt RRM_DebugDriver::WriteMemory(const TUint32 aThreadId, const TUint32 aAddress, const TUint32 aLength, const TDesC8 &aData) |
|
667 { |
|
668 TRM_DebugMemoryInfo info(aAddress, aLength, (TDesC8*)&aData); |
|
669 return DoControl(EControlWriteMemory, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
670 } |
|
671 |
|
672 inline TInt RRM_DebugDriver::ReadRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, TDes8 &aRegisterValues, TDes8 &aRegisterFlags) |
|
673 { |
|
674 TRM_DebugRegisterInformation info(&aRegisterIds, &aRegisterValues, &aRegisterFlags); |
|
675 return DoControl(EControlReadRegisters, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
676 } |
|
677 |
|
678 inline TInt RRM_DebugDriver::WriteRegisters(const TUint32 aThreadId, const TDes8 &aRegisterIds, const TDes8 &aRegisterValues, TDes8 &aRegisterFlags) |
|
679 { |
|
680 TRM_DebugRegisterInformation info(&aRegisterIds, (TDes8*)&aRegisterValues, &aRegisterFlags); |
|
681 return DoControl(EControlWriteRegisters, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
682 } |
|
683 |
|
684 inline TInt RRM_DebugDriver::ReadRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDes8 &aValues) |
|
685 { |
|
686 TRM_DebugRegisterInfo info(aFirstRegister, aLastRegister, &aValues); |
|
687 return DoControl(EControlReadRegistersLegacy, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
688 } |
|
689 |
|
690 inline TInt RRM_DebugDriver::WriteRegisters(const TUint32 aThreadId, const TInt32 aFirstRegister, const TInt32 aLastRegister, TDesC8 &aValues) |
|
691 { |
|
692 TRM_DebugRegisterInfo info(aFirstRegister, aLastRegister, &aValues); |
|
693 return DoControl(EControlWriteRegistersLegacy, reinterpret_cast<TAny*>(aThreadId), (TAny*)&info); |
|
694 } |
|
695 |
|
696 inline void RRM_DebugDriver::GetEvent(TDesC8& aProcessName, TUint64 aAgentId, TRequestStatus &aStatus, Debug::TEventInfo &aEventInfo) |
|
697 { |
|
698 // temporary object not needed beyond the DoRequest call |
|
699 TEventMetaData eventMetaData; |
|
700 eventMetaData.iTargetProcessName.Copy(aProcessName); |
|
701 eventMetaData.iDebugAgentProcessId = aAgentId; |
|
702 DoRequest(ERequestGetEvent, aStatus, (TAny*)&aEventInfo, (TAny*)&eventMetaData); |
|
703 } |
|
704 |
|
705 inline void RRM_DebugDriver::CancelGetEvent(TDesC8& aProcessName, TUint64 aAgentId) |
|
706 { |
|
707 TRMD_DebugCancelInfo info(ERequestGetEventCancel,aProcessName,aAgentId); |
|
708 DoCancel(reinterpret_cast<TInt>(&info)); |
|
709 } |
|
710 |
|
711 inline TInt RRM_DebugDriver::GetStaticLibraryInfo(const TInt aIndex, Debug::TEventInfo &aInfo) |
|
712 { |
|
713 return DoControl(EControlGetStaticLibraryInfo, reinterpret_cast<TAny*>(aIndex), (TAny*)&aInfo); |
|
714 } |
|
715 |
|
716 inline TInt RRM_DebugDriver::GetDebugFunctionalityBufSize(TUint32 &aBufSize) |
|
717 { |
|
718 return DoControl(EControlGetDebugFunctionalityBufSize, reinterpret_cast<TAny*>(&aBufSize)); |
|
719 } |
|
720 |
|
721 inline TInt RRM_DebugDriver::GetDebugFunctionality(TDes8& aDebugFunctionality) |
|
722 { |
|
723 return DoControl(EControlGetDebugFunctionality,reinterpret_cast<TAny*>(&aDebugFunctionality)); |
|
724 } |
|
725 |
|
726 inline TInt RRM_DebugDriver::GetMemoryOperationMaxBlockSize(TUint32 &aMaxSize) |
|
727 { |
|
728 return DoControl(EControlGetMemoryOperationMaxBlockSize, reinterpret_cast<TAny*>(&aMaxSize)); |
|
729 } |
|
730 |
|
731 inline TInt RRM_DebugDriver::AttachProcess(TDesC8& aProcessName, TUint64 aAgentId) |
|
732 { |
|
733 TRM_DebugAgentId info(aAgentId); |
|
734 return DoControl(EControlAttachProcess,reinterpret_cast<TAny*>(&aProcessName),reinterpret_cast<TAny*>(&info)); |
|
735 } |
|
736 |
|
737 inline TInt RRM_DebugDriver::DetachProcess(TDesC8& aProcessName, TUint64 aAgentId) |
|
738 { |
|
739 TRM_DebugAgentId info(aAgentId); |
|
740 return DoControl(EControlDetachProcess,reinterpret_cast<TAny*>(&aProcessName),reinterpret_cast<TAny*>(&info)); |
|
741 } |
|
742 |
|
743 inline TInt RRM_DebugDriver::DetachAgent(TUint64 aAgentId) |
|
744 { |
|
745 TRM_DebugAgentId info(aAgentId); |
|
746 return DoControl(EControlDetachAgent,reinterpret_cast<TAny*>(&info),0); |
|
747 } |
|
748 |
|
749 inline TInt RRM_DebugDriver::SetEventAction(TDesC8& aProcessName, Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction, TUint64 aAgentId) |
|
750 { |
|
751 TRM_DebugEventActionInfo info (aEvent,aEventAction, aAgentId); |
|
752 return DoControl(EControlSetEventAction,reinterpret_cast<TAny*>(&aProcessName),(TAny*)&info); |
|
753 } |
|
754 |
|
755 inline TInt RRM_DebugDriver::GetList(const Debug::TListId aType, const Debug::TListScope aListScope, const TUint64 aTargetId, const TUint64 aDebugProcessId, TDes8& aBuffer, TUint32& aDataSize) |
|
756 { |
|
757 TListInformation info(aType, aListScope, &aBuffer, &aDataSize, aTargetId); |
|
758 return DoControl(EControlGetList, (TAny*)&info); |
|
759 } |
|
760 |
|
761 inline TInt RRM_DebugDriver::Step(const TUint32 aThreadId, const TUint32 aNumSteps) |
|
762 { |
|
763 return DoControl(EControlStep,reinterpret_cast<TAny*>(aThreadId),reinterpret_cast<TAny*>(aNumSteps)); |
|
764 } |
|
765 |
|
766 inline TInt RRM_DebugDriver::IsDebuggable(const TUint32 aProcessId) |
|
767 { |
|
768 return DoControl(EControlIsDebuggable,reinterpret_cast<TAny*>(aProcessId),NULL); |
|
769 } |
|
770 |
|
771 inline TInt RRM_DebugDriver::KillProcess(const TUint32 aProcessId, const TInt32 aReason) |
|
772 { |
|
773 return DoControl(EControlKillProcess,reinterpret_cast<TAny*>(aProcessId),reinterpret_cast<TAny*>(aReason)); |
|
774 } |
|
775 |
|
776 #endif // __RM_DEBUG_KERNELDRIVER_H__ |
|
777 |
|