1 // Copyright (c) 2008-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 // Definitions for the data types the SCM stores to flash |
|
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 |
|
22 #ifndef __SCMDATATYPES_H_INCLUDED__ |
|
23 #define __SCMDATATYPES_H_INCLUDED__ |
|
24 |
|
25 |
|
26 #include <e32rom.h> |
|
27 |
|
28 #include <scmbytestreamutil.h> |
|
29 #include <scmtrace.h> |
|
30 |
|
31 /** |
|
32 @file |
|
33 @internalComponent |
|
34 */ |
|
35 |
|
36 namespace Debug |
|
37 { |
|
38 /** SCM Data Types Major Number */ |
|
39 static const TInt KSCMDataTypesMajorVersion = 1; |
|
40 |
|
41 /** SCM Data Types Minor Number */ |
|
42 static const TInt KSCMDataTypesMinorVersion = 0; |
|
43 |
|
44 /** SCM Data Types Build Number */ |
|
45 static const TInt KSCMDataTypesBuildNumber = 0; |
|
46 |
|
47 /** |
|
48 Specifies the type of a code segment. |
|
49 @see TCodeSegListEntry |
|
50 */ |
|
51 enum TCodeSegType |
|
52 { |
|
53 EUnknownCodeSegType = 0, /**< Signifies an unknown code segment type. */ |
|
54 EExeCodeSegType = 1, /**< Signifies a code segment belonging to an executable. */ |
|
55 EDllCodeSegType = 2 /**< Signifies a code segment belonging to a library. */ |
|
56 }; |
|
57 |
|
58 |
|
59 /** |
|
60 Used for storing the contents of a 32 bit register |
|
61 */ |
|
62 typedef TUint32 TRegisterValue32; |
|
63 |
|
64 /** |
|
65 Structure containing information about the state of the registers when a |
|
66 hardware exception occurred |
|
67 */ |
|
68 class TRmdArmExcInfo |
|
69 { |
|
70 public: |
|
71 /** Enumeration detailing the types of exception which may occur. */ |
|
72 enum TExceptionType |
|
73 { |
|
74 /** Enumerator signifying that a prefetch abort error has occurred. */ |
|
75 EPrefetchAbort = 0, |
|
76 /** Enumerator signifying that a data abort error has occurred. */ |
|
77 EDataAbort = 1, |
|
78 /** Enumerator signifying that an undefined instruction error has occurred. */ |
|
79 EUndef =2 |
|
80 }; |
|
81 |
|
82 /** Value of CPSR. */ |
|
83 TRegisterValue32 iCpsr; |
|
84 /** Type of exception which has occurred. */ |
|
85 TExceptionType iExcCode; |
|
86 /** Value of R13 supervisor mode banked register. */ |
|
87 TRegisterValue32 iR13Svc; |
|
88 /** Value of user mode register R4. */ |
|
89 TRegisterValue32 iR4; |
|
90 /** Value of user mode register R5. */ |
|
91 TRegisterValue32 iR5; |
|
92 /** Value of user mode register R6. */ |
|
93 TRegisterValue32 iR6; |
|
94 /** Value of user mode register R7. */ |
|
95 TRegisterValue32 iR7; |
|
96 /** Value of user mode register R8. */ |
|
97 TRegisterValue32 iR8; |
|
98 /** Value of user mode register R9. */ |
|
99 TRegisterValue32 iR9; |
|
100 /** Value of user mode register R10. */ |
|
101 TRegisterValue32 iR10; |
|
102 /** Value of user mode register R11. */ |
|
103 TRegisterValue32 iR11; |
|
104 /** Value of R14 supervisor mode banked register. */ |
|
105 TRegisterValue32 iR14Svc; |
|
106 /** Address which caused exception (System Control Coprocessor Fault Address Register) */ |
|
107 TRegisterValue32 iFaultAddress; |
|
108 /** Value of System Control Coprocessor Fault Status Register. */ |
|
109 TRegisterValue32 iFaultStatus; |
|
110 /** Value of SPSR supervisor mode banked register. */ |
|
111 TRegisterValue32 iSpsrSvc; |
|
112 /** Value of user mode register R13. */ |
|
113 TRegisterValue32 iR13; |
|
114 /** Value of user mode register R14. */ |
|
115 TRegisterValue32 iR14; |
|
116 /** Value of user mode register R0. */ |
|
117 TRegisterValue32 iR0; |
|
118 /** Value of user mode register R1. */ |
|
119 TRegisterValue32 iR1; |
|
120 /** Value of user mode register R2. */ |
|
121 TRegisterValue32 iR2; |
|
122 /** Value of user mode register R3. */ |
|
123 TRegisterValue32 iR3; |
|
124 /** Value of user mode register R12. */ |
|
125 TRegisterValue32 iR12; |
|
126 /** Value of user mode register R15, points to instruction which caused exception. */ |
|
127 TRegisterValue32 iR15; |
|
128 }; |
|
129 /** |
|
130 * This enum defines the type of struct we are dealing with when we |
|
131 * are serialising/deserialising |
|
132 */ |
|
133 enum SCMStructId |
|
134 { |
|
135 ESCMFirst, |
|
136 ESCMOffsetsHeader, |
|
137 ESCMTCrashInfo, |
|
138 ESCMProcessData, |
|
139 ESCMThreadData, |
|
140 ESCMThreadStack, |
|
141 ESCMRegisterValue, |
|
142 ESCMRegisterSet, |
|
143 ESCMMemory, |
|
144 ESCMCodeSegSet, |
|
145 ESCMCodeSeg, |
|
146 ESCMRawData, |
|
147 ESCMTraceData, |
|
148 ESCMLocks, |
|
149 ESCMKernelHeap, |
|
150 ESCMVariantData, |
|
151 ESCMRomHeader, |
|
152 ESCMLast |
|
153 }; |
|
154 |
|
155 /** |
|
156 * This class represents the header at the start of a crash log |
|
157 * describing the size of the crash log and minimal location |
|
158 * information |
|
159 */ |
|
160 class TCrashOffsetsHeader : public MByteStreamSerializable |
|
161 { |
|
162 public: |
|
163 |
|
164 static const TInt KSCMCrashOffsetsMaxSize = 20 * sizeof(TUint32) + sizeof(TUint16); |
|
165 |
|
166 enum TCrashHeaderVersion |
|
167 { |
|
168 EChVersion1 = 1 |
|
169 }; |
|
170 |
|
171 TCrashOffsetsHeader(); |
|
172 |
|
173 //From MByteStreamSerializable |
|
174 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
175 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
176 virtual TInt GetSize() const; |
|
177 |
|
178 TBool operator == (const TCrashOffsetsHeader& aOther) const; |
|
179 |
|
180 SCMStructId iId; |
|
181 TCrashHeaderVersion iVersion; |
|
182 |
|
183 //These next members are offsets to the crash data in the log |
|
184 TUint32 iCTFullRegOffset; |
|
185 TUint32 iCTUsrStkOffset; |
|
186 TUint32 iCTSvrStkOffset; |
|
187 TUint32 iCPMetaOffset; |
|
188 TUint32 iCTMetaOffset; |
|
189 TUint32 iCPCodeSegOffset; |
|
190 TUint32 iSysUsrStkOffset; |
|
191 TUint32 iSysSvrStkOffset; |
|
192 TUint32 iSysUsrRegOffset; |
|
193 TUint32 iSysSvrRegOffset; |
|
194 TUint32 iTLstOffset; |
|
195 TUint32 iPLstOffset; |
|
196 TUint32 iSysCodeSegOffset; |
|
197 TUint32 iExcStkOffset; |
|
198 TUint32 iTraceOffset; |
|
199 TUint32 iScmLocksOffset; |
|
200 TUint32 iKernelHeapOffset; |
|
201 TUint32 iVarSpecInfOffset; |
|
202 TUint32 iRomInfoOffset; |
|
203 |
|
204 TUint32 iSpare1; |
|
205 TUint32 iSpare2; |
|
206 TUint32 iSpare3; |
|
207 TUint32 iSpare4; |
|
208 TUint32 iSpare5; |
|
209 TUint32 iSpare6; |
|
210 |
|
211 }; |
|
212 |
|
213 /** |
|
214 * This class stores meta data for a given crash |
|
215 */ |
|
216 class TCrashInfoHeader : public MByteStreamSerializable |
|
217 { |
|
218 public: |
|
219 |
|
220 static const TInt KMaxCatSize = 80; |
|
221 static const TInt KSCMCrashInfoMaxSize = 76 + KMaxCatSize; |
|
222 |
|
223 enum TCrashInfoHeaderVersion { ECiVersion1 = 1 }; |
|
224 TCrashInfoHeader(); |
|
225 |
|
226 // from MByteStreamSerializable |
|
227 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
228 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
229 virtual TInt GetSize() const; |
|
230 |
|
231 TBool operator == (const TCrashInfoHeader& aOther) const; |
|
232 |
|
233 |
|
234 SCMStructId iId; |
|
235 TCrashInfoHeaderVersion iVersion; |
|
236 TInt32 iLogSize; |
|
237 TInt32 iFlashAlign; |
|
238 TInt32 iCachedWriterSize; |
|
239 TUint64 iPid; |
|
240 TUint64 iTid; |
|
241 TInt32 iExitType; |
|
242 TInt32 iExitReason; |
|
243 TInt32 iExcCode; |
|
244 TInt64 iCrashTime; |
|
245 TInt32 iCrashId; |
|
246 TInt32 iFlashBlockSize; |
|
247 TInt32 iFlashPartitionSize; |
|
248 TVersion iSCMDataTypesVersion; |
|
249 TUint32 iCategorySize; |
|
250 TBuf8<KMaxCatSize> iCategory; |
|
251 |
|
252 TInt32 iSpare1; |
|
253 TInt32 iSpare2; |
|
254 }; |
|
255 |
|
256 /** |
|
257 * This class is used for a raw memory dump. It will always be preceded by a TMemoryDump. |
|
258 * |
|
259 * Note: This class contains a TPtr8 to store the data |
|
260 * name. Due to us not being able to allocate memory when the system |
|
261 * is down, we assume that the memory to which this points is owned |
|
262 * by someone else. It is constructed to point to NULL. To make use |
|
263 * of this, before serialising the data, ensure to set it to point to |
|
264 * the location required. Equally, when derserialising, ensure to allocate |
|
265 * a descriptor of required bytes (determined from TMemoryDump) and set it to iData, otherwise |
|
266 * the name will be ignored upon reading. |
|
267 */ |
|
268 class TRawData : public MByteStreamSerializable |
|
269 { |
|
270 public: |
|
271 |
|
272 //Note this doesnt include the data, as this number is not determinable |
|
273 static const TInt KSCMRawDataMaxSize = 2 * sizeof(TUint32) + sizeof(TUint16); |
|
274 |
|
275 enum TTRawDataVersion { ETRawData1 = 1 }; |
|
276 TRawData(); |
|
277 |
|
278 // from MByteStreamSerializable |
|
279 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
280 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
281 virtual TInt GetSize() const; |
|
282 |
|
283 TInt Deserialize(TInt aStartPos, TByteStreamReader& aReader); |
|
284 |
|
285 SCMStructId iId; |
|
286 TTRawDataVersion iVersion; |
|
287 |
|
288 TInt32 iLength; |
|
289 TPtr8 iData; |
|
290 |
|
291 }; |
|
292 |
|
293 /** |
|
294 * This class stores meta data for a given process |
|
295 */ |
|
296 class TProcessData : public MByteStreamSerializable |
|
297 { |
|
298 public: |
|
299 |
|
300 static const TInt KSCMProcessDataMaxSize = sizeof(TUint16) + sizeof(TUint64) + 2 * sizeof(TUint32) + KMaxProcessName; |
|
301 |
|
302 enum TProcessDataVersion { EProcData1 = 1 }; |
|
303 TProcessData(); |
|
304 |
|
305 // from MByteStreamSerializable |
|
306 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
307 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
308 virtual TInt GetSize() const; |
|
309 |
|
310 SCMStructId iId; |
|
311 TProcessDataVersion iVersion; |
|
312 |
|
313 TUint64 iPid; |
|
314 TUint32 iNamesize; //Length of process filename in bytes |
|
315 TInt32 iPriority; |
|
316 |
|
317 TBuf8<KMaxProcessName> iName; |
|
318 |
|
319 TInt32 iSpare1; |
|
320 TInt32 iSpare2; |
|
321 TInt32 iSpare3; |
|
322 }; |
|
323 |
|
324 /** |
|
325 * This class stores meta data for a given thread |
|
326 */ |
|
327 class TThreadData : public MByteStreamSerializable |
|
328 { |
|
329 public: |
|
330 |
|
331 static const TInt KMaxThreadName = KMaxProcessName; |
|
332 static const TInt KSCMThreadDataMaxSize = sizeof(TUint32) + sizeof(TUint16) + 11 * sizeof(TUint32) + 2 * sizeof(TUint64) + KMaxThreadName; |
|
333 |
|
334 enum TThreadDataVersion { EThreadData1 = 1 }; |
|
335 TThreadData(); |
|
336 |
|
337 // from MByteStreamSerializable |
|
338 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
339 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
340 virtual TInt GetSize() const; |
|
341 |
|
342 SCMStructId iId; |
|
343 TInt32 iVersion; |
|
344 TInt32 iPriority; |
|
345 TUint64 iTid; |
|
346 TUint64 iOwnerId; |
|
347 TInt32 iSvcSP; |
|
348 TInt32 iSvcStack; |
|
349 TInt32 iSvcStacksize; |
|
350 TInt32 iUsrSP; |
|
351 TInt32 iUsrStack; |
|
352 TInt32 iUsrStacksize; |
|
353 TUint32 iNamesize; |
|
354 TUint32 iLastCpu; |
|
355 TInt32 iSvcHeap; |
|
356 TInt32 iSvcHeapSize; |
|
357 |
|
358 TBuf8<KMaxThreadName> iName; |
|
359 |
|
360 TInt32 iSpare1; |
|
361 TInt32 iSpare2; |
|
362 }; |
|
363 |
|
364 /** |
|
365 * This class stores the stack for a given thread. The type (user or supervisor) is given |
|
366 * by iStackType. It will be followed by a TMemoryDump containing the stack |
|
367 */ |
|
368 class TThreadStack : public MByteStreamSerializable |
|
369 { |
|
370 public: |
|
371 |
|
372 static const TInt KSCMThreadStackMaxSize = sizeof(TUint32) + sizeof(TUint16) + 2 * sizeof(TUint32) + sizeof(TUint64); |
|
373 |
|
374 enum TThreadStackVersion { EStackVersion1 = 1 }; |
|
375 |
|
376 enum TThreadStackType |
|
377 { |
|
378 EUsrStack, |
|
379 ESvrStack, |
|
380 EIRQStack, |
|
381 EFIQStack, |
|
382 ELast |
|
383 }; |
|
384 |
|
385 TThreadStack(); |
|
386 |
|
387 // from MByteStreamSerializable |
|
388 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
389 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
390 virtual TInt GetSize() const; |
|
391 |
|
392 SCMStructId iId; |
|
393 TThreadStackVersion iVersion; |
|
394 TThreadStackType iStackType; |
|
395 TUint64 iThreadId; |
|
396 TUint32 iStackSize; |
|
397 |
|
398 TInt32 iSpare1; |
|
399 TInt32 iSpare2; |
|
400 }; |
|
401 |
|
402 /** |
|
403 * Stores the value of a given register and tells you its type |
|
404 */ |
|
405 class TRegisterValue : public MByteStreamSerializable |
|
406 { |
|
407 public: |
|
408 |
|
409 static const TInt KSCMRegisterValueMaxSize = sizeof(TUint32) + sizeof(TUint16) + 2 * sizeof(TUint8) + sizeof(TUint16) + sizeof(TUint32) + 2 * sizeof(TUint64); |
|
410 |
|
411 TRegisterValue(); |
|
412 |
|
413 enum TRegisterValueVersion { ERegisterValueVersion1 = 1 }; |
|
414 |
|
415 // from MByteStreamSerializable |
|
416 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
417 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
418 virtual TInt GetSize() const; |
|
419 |
|
420 SCMStructId iId; |
|
421 TRegisterValueVersion iVersion; |
|
422 TInt64 iOwnId; |
|
423 |
|
424 /** |
|
425 * Same as Sym32_reginfod::rd_id |
|
426 * if rid_class == ESYM_REG_CORE |
|
427 * rd_id is one of rm_debug_api.h::TFunctionalityRegister |
|
428 * else |
|
429 * rd_id is CoProcessor number, eg 15 for ARM CP15 |
|
430 */ |
|
431 TUint32 iType; |
|
432 |
|
433 TUint8 iClass; //Same as Sym32_reginfod::rid_class |
|
434 TUint16 iSubId; //used for coprocessors |
|
435 |
|
436 /** |
|
437 * Same as Sym32_reginfod::rd_repre |
|
438 * ESYM_REG_8 == 0, |
|
439 * ESYM_REG_16 == 1, |
|
440 * ESYM_REG_32 == 2, |
|
441 * ESYM_REG_64 == 3 |
|
442 */ |
|
443 TUint8 iSize; //register size |
|
444 |
|
445 // Register value |
|
446 union |
|
447 { |
|
448 // Value of an 8 bit register |
|
449 TUint8 iValue8; |
|
450 |
|
451 // Value of a 16 bit register |
|
452 TUint16 iValue16; |
|
453 |
|
454 // Value of a 32 bit register |
|
455 TUint32 iValue32; |
|
456 |
|
457 // Value of a 64 bit register |
|
458 TUint64 iValue64; |
|
459 }; |
|
460 |
|
461 |
|
462 }; |
|
463 |
|
464 /** |
|
465 * This class is a header for our register set. |
|
466 */ |
|
467 class TRegisterSet : public MByteStreamSerializable |
|
468 { |
|
469 public: |
|
470 |
|
471 static const TInt KSCMRegisterSetMaxSize = sizeof(TUint32) + sizeof(TUint16) + sizeof(TUint32); |
|
472 |
|
473 TRegisterSet(); |
|
474 |
|
475 enum TRegisterSetVersion { ETRegisterSetVersion1 = 1 }; |
|
476 |
|
477 // from MByteStreamSerializable |
|
478 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
479 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
480 virtual TInt GetSize() const; |
|
481 |
|
482 TRegisterSetVersion iVersion; |
|
483 SCMStructId iId; |
|
484 TInt32 iNumRegisters; |
|
485 }; |
|
486 |
|
487 /** |
|
488 * This class describes a memory dump and will be followed by a TRawData |
|
489 */ |
|
490 class TMemoryDump : public MByteStreamSerializable |
|
491 { |
|
492 public: |
|
493 |
|
494 static const TInt KSCMMemDumpMaxSize = sizeof(TUint32) + sizeof(TUint16) + 2 * sizeof(TUint32) + sizeof(TUint64); |
|
495 |
|
496 enum TMemDumpVersionVersion { EMemDumpVersion1 = 1 }; |
|
497 |
|
498 TMemoryDump(); |
|
499 |
|
500 //From MByteStreamSerializable |
|
501 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
502 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
503 virtual TInt GetSize() const; |
|
504 |
|
505 SCMStructId iId; |
|
506 TMemDumpVersionVersion iVersion; |
|
507 TUint32 iStartAddress; |
|
508 |
|
509 TInt64 iPid; |
|
510 TInt32 iLength; |
|
511 }; |
|
512 |
|
513 /** |
|
514 * class to represent a set of code segs corrosponding to a given process |
|
515 */ |
|
516 class TCodeSegmentSet : public MByteStreamSerializable |
|
517 { |
|
518 public: |
|
519 |
|
520 static const TInt KSCMCodeSegSetMaxSize = KMaxProcessName; |
|
521 |
|
522 TCodeSegmentSet(); |
|
523 |
|
524 enum TCodeSegmentSetVersion { ETCodeSegmentSetVersion1 = 1 }; |
|
525 |
|
526 // from MByteStreamSerializable |
|
527 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
528 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
529 virtual TInt GetSize() const; |
|
530 |
|
531 TInt GetMaxSize() const; |
|
532 |
|
533 SCMStructId iId; /**< Id that uniquely identifies this data */ |
|
534 TCodeSegmentSetVersion iVersion; /**< Version of this data */ |
|
535 TInt32 iNumSegs; /**< The number of code segments following this struct that relate to this process ID */ |
|
536 TInt64 iPid; /**< Process Id that owns the following code segments */ |
|
537 }; |
|
538 |
|
539 /** |
|
540 * class to represent a code segment in the SCM Log |
|
541 */ |
|
542 class TCodeSegment : public MByteStreamSerializable |
|
543 { |
|
544 public: |
|
545 |
|
546 static const TInt KMaxSegmentNameSize = KMaxProcessName; |
|
547 |
|
548 //50 is the sum of the size of members that get serialised |
|
549 static const TInt KSCMCodeSegMaxSize = 50 + KMaxSegmentNameSize; |
|
550 |
|
551 TCodeSegment(); |
|
552 |
|
553 enum TCodeSegmentVersion { ETCodeSegmentVersion1 = 1 }; |
|
554 |
|
555 // from MByteStreamSerializable |
|
556 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
557 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
558 virtual TInt GetSize() const; |
|
559 |
|
560 TInt GetMaxSize() const; |
|
561 |
|
562 SCMStructId iId; /**< Id that uniquely identifies this data */ |
|
563 TCodeSegmentVersion iVersion; /**< Version of this data */ |
|
564 TCodeSegType iCodeSegType; /**< @see TCodeSegType */ |
|
565 TModuleMemoryInfo iCodeSegMemInfo; /**< holds the memory info for this code segment (8 TUint32's)*/ |
|
566 TBool iXip; /**< If this code segment is XIP */ |
|
567 TInt32 iNameLength; /**< Length of the name of this code segment name */ |
|
568 TBuf8<KMaxSegmentNameSize> iName; /**< Name of this code segment */ |
|
569 |
|
570 }; |
|
571 |
|
572 /** |
|
573 * This class represents a trace dump in the crash log. It will be immediately followed |
|
574 * in the crash log by a TRawData structure |
|
575 */ |
|
576 class TTraceDump : public MByteStreamSerializable |
|
577 { |
|
578 public: |
|
579 |
|
580 static const TInt KSCMTraceDumpMaxSize = sizeof(TUint32) + sizeof(TUint16) + 2 * sizeof(TUint32); |
|
581 |
|
582 TTraceDump(); |
|
583 |
|
584 enum TTraceDumpVersion { ETraceDumpVersion1 = 1 }; |
|
585 |
|
586 // from MByteStreamSerializable |
|
587 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
588 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
589 virtual TInt GetSize() const; |
|
590 |
|
591 SCMStructId iId; /**< Id that uniquely identifies this data */ |
|
592 TTraceDumpVersion iVersion; /**< Version of this data */ |
|
593 TInt32 iSizeOfMemory; /**< Size of the trace data that will be dumped in the following Memory Dump */ |
|
594 TInt32 iNumberOfParts; /**< Number of TRawData structs that will follow */ |
|
595 |
|
596 }; |
|
597 |
|
598 /** |
|
599 * This represents variant specific data in the crash log. It will be followed |
|
600 * immediately by a TRawData that contains the data |
|
601 */ |
|
602 class TVariantSpecificData : public MByteStreamSerializable |
|
603 { |
|
604 public: |
|
605 |
|
606 //sizeof(TUint32) + sizeof(TUint16) + sizeof(TUint32) |
|
607 static const TInt KSCMVarSpecMaxSize = 10; |
|
608 |
|
609 TVariantSpecificData(); |
|
610 |
|
611 enum TVariantSpecificDataVersion { EVariantSpecificDataVersion1 = 1 }; |
|
612 |
|
613 // from MByteStreamSerializable |
|
614 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
615 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
616 virtual TInt GetSize() const; |
|
617 |
|
618 SCMStructId iId; /**< Id that uniquely identifies this data */ |
|
619 TVariantSpecificDataVersion iVersion; /**< Version of this data */ |
|
620 TUint32 iSize; /**< Size of the raw data (ie the var spec info) that will follow */ |
|
621 }; |
|
622 |
|
623 /** |
|
624 * This represents the Rom Header Data in the crash Log |
|
625 */ |
|
626 class TRomHeaderData : public MByteStreamSerializable |
|
627 { |
|
628 public: |
|
629 |
|
630 static const TInt KSCMRomHdrMaxSize = sizeof(TUint32) + sizeof(TUint16) + sizeof(TUint64) + 2 * sizeof(TUint8) +sizeof(TUint16); |
|
631 |
|
632 TRomHeaderData(); |
|
633 |
|
634 enum TRomHeaderDataVersion { ERomHeaderDataVersion1 = 1 }; |
|
635 |
|
636 // from MByteStreamSerializable |
|
637 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
638 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
639 virtual TInt GetSize() const; |
|
640 |
|
641 SCMStructId iId; /**< Id that uniquely identifies this data */ |
|
642 TRomHeaderDataVersion iVersion; /**< Version of this data */ |
|
643 TUint8 iMajorVersion; /**< Major Version of ROM build */ |
|
644 TUint8 iMinorVersion; /**< Minor Version of ROM build */ |
|
645 TUint16 iBuildNumber; /**< ROM build number */ |
|
646 TUint64 iTime; /**< Build time of ROM in miliseconds */ |
|
647 }; |
|
648 |
|
649 /** |
|
650 * This represents the kernel lock info in the crash log |
|
651 */ |
|
652 class TSCMLockData : public MByteStreamSerializable |
|
653 { |
|
654 public: |
|
655 |
|
656 static const TInt KSCMLockDataMaxSize = sizeof(TUint32) + 3 * sizeof(TUint16); |
|
657 |
|
658 TSCMLockData(); |
|
659 |
|
660 // from MByteStreamSerializable |
|
661 virtual TInt Serialize(TByteStreamWriter& aWriter); |
|
662 virtual TInt Deserialize(TByteStreamReader& aReader); |
|
663 virtual TInt GetSize() const; |
|
664 |
|
665 TInt MutexHoldCount() const; |
|
666 void SetMutexHoldCount(TInt aMutexHoldCount); |
|
667 |
|
668 TInt MutexThreadWaitCount() const; |
|
669 void SetMutexThreadWaitCount(TInt aMutexThreadWaitCount); |
|
670 |
|
671 TInt LockCount() const; |
|
672 void SetLockCount(TInt aLockCount); |
|
673 |
|
674 TBool operator == (const TSCMLockData& aOther) const; |
|
675 TBool operator != (const TSCMLockData& aOther) const; |
|
676 |
|
677 private: |
|
678 SCMStructId iId; |
|
679 TInt iMutexHoldCount; // if mutex is valid number of holds on the mutex from current thread |
|
680 TInt iMutexThreadWaitCount; // if mutex is valid number of threads waiting on the mutex |
|
681 TInt iLockCount; |
|
682 |
|
683 }; |
|
684 |
|
685 /** |
|
686 * TScmChecksum class is used to provide a level of sanity checking for the data it processes |
|
687 * the check sum produced is not intended to be computationally unique |
|
688 * This implementation has been chosen as there are restrictions in the data may only be available |
|
689 * in small chunks and the entire data may not be unable to be read (ie comm port implementation) |
|
690 * These restrictions rule out the use of more sophisticated checksums that produce a checksum value for |
|
691 * an entire block of data |
|
692 */ |
|
693 class TScmChecksum : MByteStreamSerializable |
|
694 { |
|
695 public: |
|
696 TScmChecksum(); |
|
697 |
|
698 void ChecksumBlock(const TUint8* aData, TUint aLen); |
|
699 void ChecksumBlock(const TDesC8& aDes); |
|
700 TBool operator == (const TScmChecksum& aOther) const; |
|
701 TBool operator != (const TScmChecksum& aOther) const; |
|
702 void Reset(); |
|
703 |
|
704 // from MByteStreamSerializable |
|
705 TInt Serialize(TByteStreamWriter& aWriter); |
|
706 TInt Deserialize(TByteStreamReader& aReader); |
|
707 TInt GetSize() const; |
|
708 |
|
709 private: |
|
710 /** Total length of all data in bytes*/ |
|
711 TUint32 iLength; |
|
712 /** Sum of all bytes*/ |
|
713 TUint32 iSum; |
|
714 /** Count of Bytes with value 0*/ |
|
715 TUint32 iZeroCount; |
|
716 |
|
717 }; |
|
718 |
|
719 /** class to describe a flash block */ |
|
720 class SCMCrashBlockEntry |
|
721 { |
|
722 public: |
|
723 |
|
724 SCMCrashBlockEntry() |
|
725 : iBlockNumber(0) |
|
726 , iBlockOffset(0) |
|
727 , iBlockSize(0) |
|
728 , iNext(NULL) |
|
729 { |
|
730 |
|
731 } |
|
732 |
|
733 SCMCrashBlockEntry(TInt aBlockNumber, TInt aBlockOffset, TInt aBlockSize) |
|
734 : iBlockNumber(aBlockNumber) |
|
735 , iBlockOffset(aBlockOffset) |
|
736 , iBlockSize(aBlockSize) |
|
737 , iNext(NULL) |
|
738 { |
|
739 |
|
740 } |
|
741 |
|
742 /** The offset in bytes to this block from start of flash*/ |
|
743 TInt iBlockNumber; |
|
744 /** The offset in bytes to this block from start of flash*/ |
|
745 TInt iBlockOffset; |
|
746 /** the size of the flash block in bytes */ |
|
747 TInt iBlockSize; |
|
748 /** pointer to next in list*/ |
|
749 SCMCrashBlockEntry* iNext; |
|
750 |
|
751 }; |
|
752 |
|
753 /** Because of limitations in flash memory driver available to the |
|
754 * system crash monitor - this class is used to describe the locations |
|
755 * on flash where crashes will be stored |
|
756 * we store 1 crash per block of flash ! This eliminates the |
|
757 * need to for the scmonitor to hold memory required for bufering write data to flash |
|
758 * class used to describe locations (typically in flash) |
|
759 * where |
|
760 * holds a linked list of SCMCrashBlockEntry which describe an area we can write to |
|
761 */ |
|
762 class SCMMultiCrashInfo |
|
763 { |
|
764 public: |
|
765 |
|
766 /** constructor */ |
|
767 SCMMultiCrashInfo(); |
|
768 |
|
769 /** destructor */ |
|
770 ~SCMMultiCrashInfo(); |
|
771 |
|
772 /** add a pointer to a block to the list - takes ownership of block */ |
|
773 void AddBlock(SCMCrashBlockEntry* aBlockEntry); |
|
774 |
|
775 /** GetNextBlock returns NULL when no more blocks */ |
|
776 SCMCrashBlockEntry* GetNextBlock(); |
|
777 |
|
778 /** sets current block to first in list */ |
|
779 void Reset(); |
|
780 |
|
781 /** clear all entries in the list */ |
|
782 void ClearList(); |
|
783 |
|
784 |
|
785 private: |
|
786 SCMCrashBlockEntry* iFirstBlock; |
|
787 SCMCrashBlockEntry* iCurrentBlock; |
|
788 TInt iSpare; |
|
789 }; |
|
790 |
|
791 /** |
|
792 * This constant gives us the maximum size of the Core Crash Header which consists of the Crash Info, the Offsets |
|
793 * Header and the Core Registers |
|
794 */ |
|
795 static const TInt KMaxCoreHeaderSize = TCrashInfoHeader::KSCMCrashInfoMaxSize //Crash Info - always there |
|
796 + TCrashOffsetsHeader::KSCMCrashOffsetsMaxSize //offsets header - optional |
|
797 + TRegisterSet::KSCMRegisterSetMaxSize //The crash context - always there |
|
798 + TRegisterValue::KSCMRegisterValueMaxSize * 37; //could be up to 37 register values |
|
799 |
|
800 } |
|
801 |
|
802 #endif //__SCMDATATYPES_H_INCLUDED__ |
|
803 |
|
804 //eof scmdatatypes.h |
|