Update contrib.
1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test/debug/d_debugapi.h
18 #ifndef __D_DEBUGAPI_H__
19 #define __D_DEBUGAPI_H__
21 #ifdef __KERNEL_MODE__
22 #include <kernel/kdebug.h>
27 _LIT(KTestLddName, "TestDebugAPI");
29 class RDebugAPIChecker: public RBusLogicalChannel
39 /**Used to pass arguments to ldd when checking inter-process data access*/
48 static inline TVersion Version() { return TVersion(1, 0, 1); }
49 #ifndef __KERNEL_MODE__
52 inline TInt Process();
55 inline TInt IPAccess(RDebugAPIChecker::IPAccessArgs* aArgs);
60 #ifndef __KERNEL_MODE__
62 inline TInt RDebugAPIChecker::Open()
64 return DoCreate(KTestLddName, Version(), NULL, NULL, NULL, EOwnerThread);
66 inline TInt RDebugAPIChecker::Process()
68 return DoControl(ETProcess);
70 inline TInt RDebugAPIChecker::Chunk()
72 return DoControl(ETChunk);
74 inline TInt RDebugAPIChecker::Thread()
76 return DoControl(ETThread);
78 inline TInt RDebugAPIChecker::IPAccess(RDebugAPIChecker::IPAccessArgs* aArgs)
80 return DoControl(ETIPAccess, aArgs);
83 #endif //#ifndef __KERNEL_MODE__
85 #ifdef __KERNEL_MODE__
88 Holds the offsets common to all memory models.
89 @see TOffsetTableEntry.
91 struct TDebugOffsetTable
94 TInt iDebugger_ObjectOffsetTable;
95 TInt iDebugger_ObjectOffsetTableCount;
96 TInt iDebugger_ThreadContextTable;
97 TInt iDebugger_Version;
98 TInt iDebugger_OSVersion;
99 TInt iDebugger_Reserved;
100 TInt iDebugger_Containers;
101 TInt iDebugger_Scheduler;
102 TInt iDebugger_CurrentThread;
103 TInt iDebugger_CodeSegGlobalList;
104 TInt iDebugger_CodeSegLock;
105 TInt iDebugger_Change;
107 TInt iMutex_HoldCount;
108 // more debugger info
109 TInt iDebugger_ShadowPages;
110 TInt iDebugger_ShadowPageCount;
111 TInt iDebugger_EventMask;
113 TInt iObjectCon_Mutex;
114 TInt iObjectCon_Objects;
115 TInt iObjectCon_Count;
116 // more debugger info
117 TInt iDebugger_EventHandlerBreakpoint;
118 TInt iDebuggerOffset_Reserved6;
119 TInt iDebuggerOffset_Reserved7;
120 TInt iDebuggerOffset_Reserved8;
124 TInt iThread_OwningProcess;
125 TInt iThread_NThread;
126 TInt iThread_SupervisorStack;
127 TInt iThread_SupervisorStackSize;
128 TInt iThread_UserStackRunAddress;
129 TInt iThread_UserStackSize;
130 TInt iThread_UserContextType;
131 TInt iThread_SavedSupervisorSP;
132 TInt iThread_Priority;
133 TInt iThread_ThreadType;
134 TInt iDebuggerOffset_Reserved12;
138 TInt iProcess_Attributes;
139 TInt iProcess_CodeSeg;
140 TInt iProcess_DataBssRunAddress;
141 TInt iProcess_DataBssStackChunk;
142 TInt iProcess_ChunkCount; //ARMv5 specific
143 TInt iProcess_Chunks; //ARMv5 specific
144 TInt iDebuggerOffset_Reserved13;
145 TInt iDebuggerOffset_Reserved14;
146 TInt iDebuggerOffset_Reserved15;
147 TInt iDebuggerOffset_Reserved16;
149 TInt iChunkInfo_DataSectionBase; //ARMv5 specific
150 TInt iChunkInfo_Chunk; //ARMv5 specific
151 TInt iDebuggerOffset_Reserved36;
152 TInt iDebuggerOffset_Reserved37;
154 TInt iChunk_OwningProcess; //ARMv5 specific
156 TInt iChunk_Attributes;
157 TInt iChunk_ChunkType;
158 TInt iChunk_ChunkState; //ARMv5 specific
159 TInt iChunk_HomeBase; //ARMv5 specific
160 TInt iDebuggerOffset_Reserved17;
161 TInt iDebuggerOffset_Reserved18;
162 TInt iDebuggerOffset_Reserved19;
163 TInt iDebuggerOffset_Reserved20;
165 TInt iLibrary_MapCount;
167 TInt iLibrary_CodeSeg;
168 TInt iDebuggerOffset_Reserved21;
169 TInt iDebuggerOffset_Reserved22;
170 TInt iDebuggerOffset_Reserved23;
171 TInt iDebuggerOffset_Reserved24;
176 TInt iCodeSeg_DepsCount;
177 TInt iCodeSeg_FileName;
180 TInt iDebuggerOffset_Reserved25;
181 TInt iDebuggerOffset_Reserved26;
182 TInt iDebuggerOffset_Reserved27;
183 TInt iDebuggerOffset_Reserved28;
185 TInt iScheduler_KernCSLocked;
186 TInt iScheduler_LockWaiting;
187 TInt iScheduler_CurrentThread;
188 TInt iScheduler_AddressSpace;
189 TInt iDebuggerOffset_Reserved29;
190 TInt iDebuggerOffset_Reserved30;
191 TInt iDebuggerOffset_Reserved31;
192 TInt iDebuggerOffset_Reserved32;
193 // code segment information non-XIP
194 TInt iCodeSegInfoRAM_CodeSize;
195 TInt iCodeSegInfoRAM_TextSize;
196 TInt iCodeSegInfoRAM_DataSize;
197 TInt iCodeSegInfoRAM_BssSize;
198 TInt iCodeSegInfoRAM_CodeRunAddress;
199 TInt iCodeSegInfoRAM_CodeLoadAddress;
200 TInt iCodeSegInfoRAM_DataRunAddr;
201 TInt iCodeSegInfoRAM_DataLoadAddr;
202 TInt iCodeSegInfoRAM_ConstOffset;
203 TInt iCodeSegInfoRAM_ExportDir;
204 TInt iCodeSegInfoRAM_ExportDirCount;
205 TInt iDebuggerOffset_Reserved38;
206 TInt iDebuggerOffset_Reserved39;
207 TInt iDebuggerOffset_Reserved40;
208 TInt iDebuggerOffset_Reserved41;
209 // code segment information XIP
210 TInt iCodeSegInfoXIP_CodeAddress;
211 TInt iCodeSegInfoXIP_DataAddress;
212 TInt iCodeSegInfoXIP_DataRunAddress;
213 TInt iCodeSegInfoXIP_CodeSize;
214 TInt iCodeSegInfoXIP_TextSize;
215 TInt iCodeSegInfoXIP_DataSize;
216 TInt iCodeSegInfoXIP_BssSize;
217 TInt iCodeSegInfoXIP_ExportDir;
218 TInt iCodeSegInfoXIP_ExportDirCount;
219 TInt iDebuggerOffset_Reserved42;
220 TInt iDebuggerOffset_Reserved43;
221 TInt iDebuggerOffset_Reserved44;
222 TInt iDebuggerOffset_Reserved45;
226 Holds the offsets specific to moving memory models.
227 @see TOffsetMovingTableEntry
229 struct TMovingDebugOffsetTable
231 TInt iProcess_ChunkCount;
232 TInt iProcess_Chunks;
234 TInt iChunkInfo_DataSectionBase;
235 TInt iChunkInfo_Chunk;
237 TInt iChunk_OwningProcess;
238 TInt iChunk_ChunkState;
239 TInt iChunk_HomeBase;
248 Holds the offsets specific to multiple memory models.
249 @see TOffsetMultipleTableEntry
251 struct TMultipleDebugOffsetTable
253 TInt iProcess_OsAsid;
254 TInt iProcess_LocalPageDir;
255 TInt iProcess_ChunkCount;
256 TInt iProcess_Chunks;
257 TInt iChunkInfo_Chunk;
258 TInt iChunk_OwningProcess;
265 class DDebugAPIChecker : public DLogicalChannelBase
268 virtual ~DDebugAPIChecker();
270 // from DLogicalChannelBase
271 virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
272 virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
274 inline TInt8 Read8(void* aBase, TInt aOffset) {return *((TInt8*)aBase + aOffset);}
275 inline TInt Read(void* aBase, TInt aOffset) {return (TInt) (*((TInt*)((TInt8*)aBase + aOffset)));}
280 TInt IPAccess(TAny* a1);
281 TUint8* ExtractName(TInt aSymbianName, TUint8* aCharName);
284 TInt ReadFromOtherProcessArmv6();
287 DDebuggerInfo* iDebugInfo;
288 TDebugOffsetTable* iOffsetTable;/**Contains the offsets common to all memory models*/
289 TMemoryModelType iMMUType; /**Identifies the memory model*/
290 void* iVariantOffsetTable; /**Contains memory-model-spacific offsets*/
291 TInt* iScheduler; /**Will hold the address of the scheduler*/
293 TInt iCurrentProcess_OsAsid; //Used to call ReadFromOtherProcessArmv6
294 TInt iCurrentProcess_LocalPageDir; //Used to call ReadFromOtherProcessArmv6
295 TInt iOtherProcess_OsAsid; //Used to call ReadFromOtherProcessArmv6
296 TInt iOtherProcess_LocalPageDir; //Used to call ReadFromOtherProcessArmv6
297 TInt iAddress; //Used to call ReadFromOtherProcessArmv6
300 #endif //#ifdef __KERNEL_MODE__
302 #endif // __D_DEBUGAPI_H__