sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test/debug/d_debugapi.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef __D_DEBUGAPI_H__
|
sl@0
|
19 |
#define __D_DEBUGAPI_H__
|
sl@0
|
20 |
|
sl@0
|
21 |
#ifdef __KERNEL_MODE__
|
sl@0
|
22 |
#include <kernel/kdebug.h>
|
sl@0
|
23 |
#else
|
sl@0
|
24 |
#include <e32std.h>
|
sl@0
|
25 |
#endif
|
sl@0
|
26 |
|
sl@0
|
27 |
_LIT(KTestLddName, "TestDebugAPI");
|
sl@0
|
28 |
|
sl@0
|
29 |
class RDebugAPIChecker: public RBusLogicalChannel
|
sl@0
|
30 |
{
|
sl@0
|
31 |
public:
|
sl@0
|
32 |
enum
|
sl@0
|
33 |
{
|
sl@0
|
34 |
ETProcess,
|
sl@0
|
35 |
ETChunk,
|
sl@0
|
36 |
ETThread,
|
sl@0
|
37 |
ETIPAccess
|
sl@0
|
38 |
};
|
sl@0
|
39 |
/**Used to pass arguments to ldd when checking inter-process data access*/
|
sl@0
|
40 |
struct IPAccessArgs
|
sl@0
|
41 |
{
|
sl@0
|
42 |
TUint iProcessID;
|
sl@0
|
43 |
TUint iAddress;
|
sl@0
|
44 |
TUint iValue;
|
sl@0
|
45 |
};
|
sl@0
|
46 |
|
sl@0
|
47 |
public:
|
sl@0
|
48 |
static inline TVersion Version() { return TVersion(1, 0, 1); }
|
sl@0
|
49 |
#ifndef __KERNEL_MODE__
|
sl@0
|
50 |
public:
|
sl@0
|
51 |
inline TInt Open();
|
sl@0
|
52 |
inline TInt Process();
|
sl@0
|
53 |
inline TInt Chunk();
|
sl@0
|
54 |
inline TInt Thread();
|
sl@0
|
55 |
inline TInt IPAccess(RDebugAPIChecker::IPAccessArgs* aArgs);
|
sl@0
|
56 |
#endif
|
sl@0
|
57 |
};
|
sl@0
|
58 |
|
sl@0
|
59 |
|
sl@0
|
60 |
#ifndef __KERNEL_MODE__
|
sl@0
|
61 |
|
sl@0
|
62 |
inline TInt RDebugAPIChecker::Open()
|
sl@0
|
63 |
{
|
sl@0
|
64 |
return DoCreate(KTestLddName, Version(), NULL, NULL, NULL, EOwnerThread);
|
sl@0
|
65 |
}
|
sl@0
|
66 |
inline TInt RDebugAPIChecker::Process()
|
sl@0
|
67 |
{
|
sl@0
|
68 |
return DoControl(ETProcess);
|
sl@0
|
69 |
}
|
sl@0
|
70 |
inline TInt RDebugAPIChecker::Chunk()
|
sl@0
|
71 |
{
|
sl@0
|
72 |
return DoControl(ETChunk);
|
sl@0
|
73 |
}
|
sl@0
|
74 |
inline TInt RDebugAPIChecker::Thread()
|
sl@0
|
75 |
{
|
sl@0
|
76 |
return DoControl(ETThread);
|
sl@0
|
77 |
}
|
sl@0
|
78 |
inline TInt RDebugAPIChecker::IPAccess(RDebugAPIChecker::IPAccessArgs* aArgs)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
return DoControl(ETIPAccess, aArgs);
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
#endif //#ifndef __KERNEL_MODE__
|
sl@0
|
84 |
|
sl@0
|
85 |
#ifdef __KERNEL_MODE__
|
sl@0
|
86 |
|
sl@0
|
87 |
/**
|
sl@0
|
88 |
Holds the offsets common to all memory models.
|
sl@0
|
89 |
@see TOffsetTableEntry.
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
struct TDebugOffsetTable
|
sl@0
|
92 |
{
|
sl@0
|
93 |
// debugger info
|
sl@0
|
94 |
TInt iDebugger_ObjectOffsetTable;
|
sl@0
|
95 |
TInt iDebugger_ObjectOffsetTableCount;
|
sl@0
|
96 |
TInt iDebugger_ThreadContextTable;
|
sl@0
|
97 |
TInt iDebugger_Version;
|
sl@0
|
98 |
TInt iDebugger_OSVersion;
|
sl@0
|
99 |
TInt iDebugger_Reserved;
|
sl@0
|
100 |
TInt iDebugger_Containers;
|
sl@0
|
101 |
TInt iDebugger_Scheduler;
|
sl@0
|
102 |
TInt iDebugger_CurrentThread;
|
sl@0
|
103 |
TInt iDebugger_CodeSegGlobalList;
|
sl@0
|
104 |
TInt iDebugger_CodeSegLock;
|
sl@0
|
105 |
TInt iDebugger_Change;
|
sl@0
|
106 |
// DMutex info
|
sl@0
|
107 |
TInt iMutex_HoldCount;
|
sl@0
|
108 |
// more debugger info
|
sl@0
|
109 |
TInt iDebugger_ShadowPages;
|
sl@0
|
110 |
TInt iDebugger_ShadowPageCount;
|
sl@0
|
111 |
TInt iDebugger_EventMask;
|
sl@0
|
112 |
// DObjectCon info
|
sl@0
|
113 |
TInt iObjectCon_Mutex;
|
sl@0
|
114 |
TInt iObjectCon_Objects;
|
sl@0
|
115 |
TInt iObjectCon_Count;
|
sl@0
|
116 |
// more debugger info
|
sl@0
|
117 |
TInt iDebugger_EventHandlerBreakpoint;
|
sl@0
|
118 |
TInt iDebuggerOffset_Reserved6;
|
sl@0
|
119 |
TInt iDebuggerOffset_Reserved7;
|
sl@0
|
120 |
TInt iDebuggerOffset_Reserved8;
|
sl@0
|
121 |
// thread info
|
sl@0
|
122 |
TInt iThread_Name;
|
sl@0
|
123 |
TInt iThread_Id;
|
sl@0
|
124 |
TInt iThread_OwningProcess;
|
sl@0
|
125 |
TInt iThread_NThread;
|
sl@0
|
126 |
TInt iThread_SupervisorStack;
|
sl@0
|
127 |
TInt iThread_SupervisorStackSize;
|
sl@0
|
128 |
TInt iThread_UserStackRunAddress;
|
sl@0
|
129 |
TInt iThread_UserStackSize;
|
sl@0
|
130 |
TInt iThread_UserContextType;
|
sl@0
|
131 |
TInt iThread_SavedSupervisorSP;
|
sl@0
|
132 |
TInt iThread_Priority;
|
sl@0
|
133 |
TInt iThread_ThreadType;
|
sl@0
|
134 |
TInt iDebuggerOffset_Reserved12;
|
sl@0
|
135 |
// process info
|
sl@0
|
136 |
TInt iProcess_Name;
|
sl@0
|
137 |
TInt iProcess_Id;
|
sl@0
|
138 |
TInt iProcess_Attributes;
|
sl@0
|
139 |
TInt iProcess_CodeSeg;
|
sl@0
|
140 |
TInt iProcess_DataBssRunAddress;
|
sl@0
|
141 |
TInt iProcess_DataBssStackChunk;
|
sl@0
|
142 |
TInt iProcess_ChunkCount; //ARMv5 specific
|
sl@0
|
143 |
TInt iProcess_Chunks; //ARMv5 specific
|
sl@0
|
144 |
TInt iDebuggerOffset_Reserved13;
|
sl@0
|
145 |
TInt iDebuggerOffset_Reserved14;
|
sl@0
|
146 |
TInt iDebuggerOffset_Reserved15;
|
sl@0
|
147 |
TInt iDebuggerOffset_Reserved16;
|
sl@0
|
148 |
// chunkinfo info
|
sl@0
|
149 |
TInt iChunkInfo_DataSectionBase; //ARMv5 specific
|
sl@0
|
150 |
TInt iChunkInfo_Chunk; //ARMv5 specific
|
sl@0
|
151 |
TInt iDebuggerOffset_Reserved36;
|
sl@0
|
152 |
TInt iDebuggerOffset_Reserved37;
|
sl@0
|
153 |
// chunk info
|
sl@0
|
154 |
TInt iChunk_OwningProcess; //ARMv5 specific
|
sl@0
|
155 |
TInt iChunk_Size;
|
sl@0
|
156 |
TInt iChunk_Attributes;
|
sl@0
|
157 |
TInt iChunk_ChunkType;
|
sl@0
|
158 |
TInt iChunk_ChunkState; //ARMv5 specific
|
sl@0
|
159 |
TInt iChunk_HomeBase; //ARMv5 specific
|
sl@0
|
160 |
TInt iDebuggerOffset_Reserved17;
|
sl@0
|
161 |
TInt iDebuggerOffset_Reserved18;
|
sl@0
|
162 |
TInt iDebuggerOffset_Reserved19;
|
sl@0
|
163 |
TInt iDebuggerOffset_Reserved20;
|
sl@0
|
164 |
// library info
|
sl@0
|
165 |
TInt iLibrary_MapCount;
|
sl@0
|
166 |
TInt iLibrary_State;
|
sl@0
|
167 |
TInt iLibrary_CodeSeg;
|
sl@0
|
168 |
TInt iDebuggerOffset_Reserved21;
|
sl@0
|
169 |
TInt iDebuggerOffset_Reserved22;
|
sl@0
|
170 |
TInt iDebuggerOffset_Reserved23;
|
sl@0
|
171 |
TInt iDebuggerOffset_Reserved24;
|
sl@0
|
172 |
// code seg info
|
sl@0
|
173 |
TInt iCodeSeg_Next;
|
sl@0
|
174 |
TInt iCodeSeg_Prev;
|
sl@0
|
175 |
TInt iCodeSeg_Deps;
|
sl@0
|
176 |
TInt iCodeSeg_DepsCount;
|
sl@0
|
177 |
TInt iCodeSeg_FileName;
|
sl@0
|
178 |
TInt iCodeSeg_XIP;
|
sl@0
|
179 |
TInt iCodeSeg_Info;
|
sl@0
|
180 |
TInt iDebuggerOffset_Reserved25;
|
sl@0
|
181 |
TInt iDebuggerOffset_Reserved26;
|
sl@0
|
182 |
TInt iDebuggerOffset_Reserved27;
|
sl@0
|
183 |
TInt iDebuggerOffset_Reserved28;
|
sl@0
|
184 |
// scheduler info
|
sl@0
|
185 |
TInt iScheduler_KernCSLocked;
|
sl@0
|
186 |
TInt iScheduler_LockWaiting;
|
sl@0
|
187 |
TInt iScheduler_CurrentThread;
|
sl@0
|
188 |
TInt iScheduler_AddressSpace;
|
sl@0
|
189 |
TInt iDebuggerOffset_Reserved29;
|
sl@0
|
190 |
TInt iDebuggerOffset_Reserved30;
|
sl@0
|
191 |
TInt iDebuggerOffset_Reserved31;
|
sl@0
|
192 |
TInt iDebuggerOffset_Reserved32;
|
sl@0
|
193 |
// code segment information non-XIP
|
sl@0
|
194 |
TInt iCodeSegInfoRAM_CodeSize;
|
sl@0
|
195 |
TInt iCodeSegInfoRAM_TextSize;
|
sl@0
|
196 |
TInt iCodeSegInfoRAM_DataSize;
|
sl@0
|
197 |
TInt iCodeSegInfoRAM_BssSize;
|
sl@0
|
198 |
TInt iCodeSegInfoRAM_CodeRunAddress;
|
sl@0
|
199 |
TInt iCodeSegInfoRAM_CodeLoadAddress;
|
sl@0
|
200 |
TInt iCodeSegInfoRAM_DataRunAddr;
|
sl@0
|
201 |
TInt iCodeSegInfoRAM_DataLoadAddr;
|
sl@0
|
202 |
TInt iCodeSegInfoRAM_ConstOffset;
|
sl@0
|
203 |
TInt iCodeSegInfoRAM_ExportDir;
|
sl@0
|
204 |
TInt iCodeSegInfoRAM_ExportDirCount;
|
sl@0
|
205 |
TInt iDebuggerOffset_Reserved38;
|
sl@0
|
206 |
TInt iDebuggerOffset_Reserved39;
|
sl@0
|
207 |
TInt iDebuggerOffset_Reserved40;
|
sl@0
|
208 |
TInt iDebuggerOffset_Reserved41;
|
sl@0
|
209 |
// code segment information XIP
|
sl@0
|
210 |
TInt iCodeSegInfoXIP_CodeAddress;
|
sl@0
|
211 |
TInt iCodeSegInfoXIP_DataAddress;
|
sl@0
|
212 |
TInt iCodeSegInfoXIP_DataRunAddress;
|
sl@0
|
213 |
TInt iCodeSegInfoXIP_CodeSize;
|
sl@0
|
214 |
TInt iCodeSegInfoXIP_TextSize;
|
sl@0
|
215 |
TInt iCodeSegInfoXIP_DataSize;
|
sl@0
|
216 |
TInt iCodeSegInfoXIP_BssSize;
|
sl@0
|
217 |
TInt iCodeSegInfoXIP_ExportDir;
|
sl@0
|
218 |
TInt iCodeSegInfoXIP_ExportDirCount;
|
sl@0
|
219 |
TInt iDebuggerOffset_Reserved42;
|
sl@0
|
220 |
TInt iDebuggerOffset_Reserved43;
|
sl@0
|
221 |
TInt iDebuggerOffset_Reserved44;
|
sl@0
|
222 |
TInt iDebuggerOffset_Reserved45;
|
sl@0
|
223 |
};
|
sl@0
|
224 |
|
sl@0
|
225 |
/**
|
sl@0
|
226 |
Holds the offsets specific to moving memory models.
|
sl@0
|
227 |
@see TOffsetMovingTableEntry
|
sl@0
|
228 |
*/
|
sl@0
|
229 |
struct TMovingDebugOffsetTable
|
sl@0
|
230 |
{
|
sl@0
|
231 |
TInt iProcess_ChunkCount;
|
sl@0
|
232 |
TInt iProcess_Chunks;
|
sl@0
|
233 |
|
sl@0
|
234 |
TInt iChunkInfo_DataSectionBase;
|
sl@0
|
235 |
TInt iChunkInfo_Chunk;
|
sl@0
|
236 |
|
sl@0
|
237 |
TInt iChunk_OwningProcess;
|
sl@0
|
238 |
TInt iChunk_ChunkState;
|
sl@0
|
239 |
TInt iChunk_HomeBase;
|
sl@0
|
240 |
|
sl@0
|
241 |
TInt iReserved1;
|
sl@0
|
242 |
TInt iReserved2;
|
sl@0
|
243 |
TInt iReserved3;
|
sl@0
|
244 |
TInt iReserved4;
|
sl@0
|
245 |
};
|
sl@0
|
246 |
|
sl@0
|
247 |
/**
|
sl@0
|
248 |
Holds the offsets specific to multiple memory models.
|
sl@0
|
249 |
@see TOffsetMultipleTableEntry
|
sl@0
|
250 |
*/
|
sl@0
|
251 |
struct TMultipleDebugOffsetTable
|
sl@0
|
252 |
{
|
sl@0
|
253 |
TInt iProcess_OsAsid;
|
sl@0
|
254 |
TInt iProcess_LocalPageDir;
|
sl@0
|
255 |
TInt iProcess_ChunkCount;
|
sl@0
|
256 |
TInt iProcess_Chunks;
|
sl@0
|
257 |
TInt iChunkInfo_Chunk;
|
sl@0
|
258 |
TInt iChunk_OwningProcess;
|
sl@0
|
259 |
TInt iReserved1;
|
sl@0
|
260 |
TInt iReserved2;
|
sl@0
|
261 |
TInt iReserved3;
|
sl@0
|
262 |
TInt iReserved4;
|
sl@0
|
263 |
};
|
sl@0
|
264 |
|
sl@0
|
265 |
class DDebugAPIChecker : public DLogicalChannelBase
|
sl@0
|
266 |
{
|
sl@0
|
267 |
public:
|
sl@0
|
268 |
virtual ~DDebugAPIChecker();
|
sl@0
|
269 |
protected:
|
sl@0
|
270 |
// from DLogicalChannelBase
|
sl@0
|
271 |
virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
|
sl@0
|
272 |
virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
|
sl@0
|
273 |
private:
|
sl@0
|
274 |
inline TInt8 Read8(void* aBase, TInt aOffset) {return *((TInt8*)aBase + aOffset);}
|
sl@0
|
275 |
inline TInt Read(void* aBase, TInt aOffset) {return (TInt) (*((TInt*)((TInt8*)aBase + aOffset)));}
|
sl@0
|
276 |
|
sl@0
|
277 |
TInt Process();
|
sl@0
|
278 |
TInt Chunk();
|
sl@0
|
279 |
TInt Thread();
|
sl@0
|
280 |
TInt IPAccess(TAny* a1);
|
sl@0
|
281 |
TUint8* ExtractName(TInt aSymbianName, TUint8* aCharName);
|
sl@0
|
282 |
TInt GetOffsets();
|
sl@0
|
283 |
|
sl@0
|
284 |
TInt ReadFromOtherProcessArmv6();
|
sl@0
|
285 |
|
sl@0
|
286 |
private:
|
sl@0
|
287 |
DDebuggerInfo* iDebugInfo;
|
sl@0
|
288 |
TDebugOffsetTable* iOffsetTable;/**Contains the offsets common to all memory models*/
|
sl@0
|
289 |
TMemoryModelType iMMUType; /**Identifies the memory model*/
|
sl@0
|
290 |
void* iVariantOffsetTable; /**Contains memory-model-spacific offsets*/
|
sl@0
|
291 |
TInt* iScheduler; /**Will hold the address of the scheduler*/
|
sl@0
|
292 |
|
sl@0
|
293 |
TInt iCurrentProcess_OsAsid; //Used to call ReadFromOtherProcessArmv6
|
sl@0
|
294 |
TInt iCurrentProcess_LocalPageDir; //Used to call ReadFromOtherProcessArmv6
|
sl@0
|
295 |
TInt iOtherProcess_OsAsid; //Used to call ReadFromOtherProcessArmv6
|
sl@0
|
296 |
TInt iOtherProcess_LocalPageDir; //Used to call ReadFromOtherProcessArmv6
|
sl@0
|
297 |
TInt iAddress; //Used to call ReadFromOtherProcessArmv6
|
sl@0
|
298 |
};
|
sl@0
|
299 |
|
sl@0
|
300 |
#endif //#ifdef __KERNEL_MODE__
|
sl@0
|
301 |
|
sl@0
|
302 |
#endif // __D_DEBUGAPI_H__
|