|
1 // Copyright (c) 2007-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 "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 // Simulated Data Source API that supplies crash information |
|
15 // by implementing the data source API CCrashDataSource |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalTechnology |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef TEST_CRASH_DATA_SOURCE_H |
|
27 #define TEST_CRASH_DATA_SOURCE_H |
|
28 |
|
29 #include <e32std.h> |
|
30 #include <e32base.h> |
|
31 |
|
32 |
|
33 #include <crashdatasource.h> |
|
34 #include <scmdatatypes.h> |
|
35 // |
|
36 // CTestCrashDataSource |
|
37 // |
|
38 class CTestCrashDataSource : public CCrashDataSource |
|
39 { |
|
40 public: |
|
41 |
|
42 CTestCrashDataSource(); |
|
43 |
|
44 virtual ~CTestCrashDataSource(); |
|
45 protected: |
|
46 virtual void ConstructL(); |
|
47 |
|
48 public: |
|
49 |
|
50 /** This call returns information on all available registers. It does not |
|
51 return the register contents. This is used to establish which registers |
|
52 a formatter could ask for, in particular for Co Processor registers. |
|
53 The callee (not the caller) allocates aRegisterList. |
|
54 This method is used by a formatter to establish which registers it can ask for, |
|
55 and thus need only be called once per session. */ |
|
56 virtual void GetRegisterListL( RRegisterList & aRegisterList ); |
|
57 |
|
58 /** Ask the Core Dump server for some register data. The caller allocates |
|
59 the array and fills in the details of the registers that it would like |
|
60 the contents for */ |
|
61 virtual void ReadRegistersL( const TUint64 aThreadId, RRegisterList &aRegisterList ); |
|
62 |
|
63 // |
|
64 // Argument aLength must be a multiple of aAccessSize |
|
65 // Argument aAddress is aAccessSize aligned |
|
66 // The existence of argument aEndianess is not published, |
|
67 // allowing for future implementation |
|
68 // |
|
69 virtual void ReadMemoryL( |
|
70 const TUint64 aThreadId, |
|
71 const TUint32 aAddress, |
|
72 const TUint32 aLength, |
|
73 TDes8 & aData ); |
|
74 |
|
75 |
|
76 // |
|
77 // Get process list |
|
78 // |
|
79 virtual void GetProcessListL( RProcessPointerList & aData, |
|
80 TUint & aTotalProcessListDescSize ); |
|
81 |
|
82 // |
|
83 // Get executable list |
|
84 // |
|
85 virtual void GetExecutableListL( RExecutablePointerList & aData, |
|
86 TUint & aTotalExecutableListDescSize ); |
|
87 |
|
88 |
|
89 // |
|
90 // Get the thread list for a given process |
|
91 // |
|
92 //virtual TInt GetThreadList( const TUint32 aProcessId, RThreadList& aThreadList ); |
|
93 virtual void GetThreadListL( const TUint64 aProcessId, |
|
94 RThreadPointerList & aThreadList, |
|
95 TUint & aTotalThreadListDescSize ); |
|
96 |
|
97 |
|
98 virtual void GetThreadListL( const TUint32 aProcessId, |
|
99 RThreadPointerList & aThreadList, |
|
100 TUint & aTotalThreadListDescSize ); |
|
101 |
|
102 // |
|
103 // API calls below come from the prototype |
|
104 // |
|
105 virtual void GetCodeSegmentsL(const TUint64 aTid, RCodeSegPointerList &aCodeSegs, TUint &aTotalCodeSegListDescSize); |
|
106 |
|
107 virtual void ReadTraceBufferL(TDes8 &aTraceData ); |
|
108 |
|
109 virtual void GetLocksL(TSCMLockData& aLockData); |
|
110 |
|
111 virtual void GetROMBuildInfoL(TRomHeaderData& aRomHeader); |
|
112 |
|
113 virtual TUint GetExceptionStackSizeL(const Debug::TArmProcessorModes aMode); |
|
114 |
|
115 virtual void GetExceptionStackL(const Debug::TArmProcessorModes aMode, TDes8& aStack, TUint aStartReadPoint); |
|
116 |
|
117 virtual TInt GetDataSourceFunctionality(TDes8& aFuncBuffer); |
|
118 |
|
119 virtual TInt GetDataSourceFunctionalityBufSize(TUint& aBufSize); |
|
120 |
|
121 virtual TInt GetVariantSpecificDataSize(TUint& aDataSize); |
|
122 |
|
123 virtual TInt GetVariantSpecificData(TDes8& aVarSpecData); |
|
124 |
|
125 virtual TVersion GetVersion() const; |
|
126 |
|
127 private: |
|
128 |
|
129 TInt SetSimRegInfo( RRegisterList & aRegisterList ); |
|
130 |
|
131 TInt SetSimRegValues( const TUint32 aThreadId, |
|
132 RRegisterList & aRegisterList ); |
|
133 |
|
134 void PrintRegs( RRegisterList & aRegisterList ); |
|
135 |
|
136 }; |
|
137 |
|
138 //test consts defines |
|
139 enum TTestExcCode |
|
140 { |
|
141 EPrefetchAbort=0, |
|
142 EDataAbort=1, |
|
143 EUndefinedOpcode=2 |
|
144 }; |
|
145 enum TTestExitType |
|
146 { |
|
147 EException, |
|
148 EPanic, |
|
149 ETerminate, |
|
150 EPending |
|
151 }; |
|
152 |
|
153 enum TTestExitReason |
|
154 { |
|
155 EUser, |
|
156 EKernel, |
|
157 ENone |
|
158 }; |
|
159 |
|
160 const TInt KCrashFaultAddress = 0x01020304; |
|
161 const TInt KCrashFaultStatus = 0x00011000; |
|
162 const TInt32 KCrc32 = 0x1234FEDC; |
|
163 const TCrashInfo::TCrashType KCrashType = TCrashInfo::ECrashKill; |
|
164 const TTestExitReason KCrashReason = EKernel; |
|
165 const TRmdArmExcInfo::TExceptionType KCrashExcCode = TRmdArmExcInfo::EPrefetchAbort; |
|
166 |
|
167 |
|
168 const TBool KCrashXIP = EFalse; |
|
169 _LIT( KCrashCategory, "crash_category" ); |
|
170 _LIT8( KCrashCategory8, "crash_category" ); |
|
171 _LIT( KCrashFileName, "crash_application.exe"); |
|
172 _LIT8( KCrashFileName8, "crash_application.exe"); |
|
173 const TUint64 KCrashTid = 0x0123; |
|
174 const TUint64 KCrashPid = 0x0789; |
|
175 const TUint64 KCrashTime = MAKE_TUINT64(0xFEDCBA98u,0x76543210u); |
|
176 _LIT( KCrashThreadName, "crash-thread"); |
|
177 _LIT8( KCrashThreadName8, "crash-thread"); |
|
178 const TUint KCrashThreadsCount = 4; |
|
179 const TUint KCrashThreadPriority = 42; |
|
180 const TUint KCrashUsrStackAddr = 0x44332211; |
|
181 const TUint KCrashUsrStackSize = 0x20; |
|
182 const TUint KCrashSvcStackPtr = 0x11223344; |
|
183 const TUint KCrashSvcStackAddr = 0x22334455; |
|
184 const TUint KCrashSvcStackSize = 0x20; |
|
185 |
|
186 const TUint KCrashCodeSize = 0x10; |
|
187 const TUint KCrashCodeRunAddr = 0x01010101; |
|
188 const TUint KCrashCodeLoadAddr = 0x02020202; |
|
189 const TUint KCrashRODataSize = 0x20; |
|
190 const TUint KCrashRODataRunAddr = 0x03030303; |
|
191 const TUint KCrashRODataLoadAddr = 0x04040404; |
|
192 const TUint KCrashDataSize = 0x30; |
|
193 const TUint KCrashDataRunAddr = 0x05050505; |
|
194 const TUint KCrashDataLoadAddr = 0x60606006; |
|
195 |
|
196 |
|
197 _LIT( KCrashProcessName, "crash_application.exe"); |
|
198 _LIT( KLibName1, "application1.dll"); |
|
199 _LIT( KLibName2, "application2.dll"); |
|
200 |
|
201 _LIT8( KCrashProcessName8, "crash_application.exe"); |
|
202 _LIT8( KLibName1_8, "application1.dll"); |
|
203 _LIT8( KLibName2_8, "application2.dll"); |
|
204 |
|
205 |
|
206 const TUint KCoreRegsCount = 16; |
|
207 const TUint KCoProRegsCount = 16; |
|
208 const TUint KRegSubId = 0x11; |
|
209 const TUint8 KRegValue8 = 0x10; |
|
210 const TUint16 KRegValue16 = 0x3210; |
|
211 const TUint32 KRegValue32 = 0x76543210; |
|
212 const TUint64 KRegValue64 = MAKE_TUINT64(0xFEDCBA98u,0x76543210u); |
|
213 |
|
214 const TUint KCodeSegsCount = 3; |
|
215 const TUint KCodeSegBase = 0x01020304; |
|
216 const TUint KCodeSegSize = 0x20; |
|
217 |
|
218 const TUint KDataSegsCount = 7; |
|
219 const TUint KDataSegBase = 0x09080706; |
|
220 const TUint KDataSegSize = 0x40; |
|
221 |
|
222 #endif // TEST_CRASH_DATA_SOURCE_H |
|
223 |
|
224 |