sl@0
|
1 |
// Copyright (c) 2002-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 |
// e32\include\kernel\kdebug.h
|
sl@0
|
15 |
// Public header for kernel debugger interface
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __KDEBUG_H__
|
sl@0
|
20 |
#define __KDEBUG_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <kernel/kern_priv.h>
|
sl@0
|
23 |
#include <kernel/debug.h>
|
sl@0
|
24 |
#include <e32ver.h>
|
sl@0
|
25 |
#include <sm_debug_api.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
/**
|
sl@0
|
29 |
Defines the major version number of the stop-mode debug API
|
sl@0
|
30 |
|
sl@0
|
31 |
@publishedPartner
|
sl@0
|
32 |
@released
|
sl@0
|
33 |
*/
|
sl@0
|
34 |
const TInt KDebuggerMajorVersionNumber = 1;
|
sl@0
|
35 |
/**
|
sl@0
|
36 |
Defines the minor version number of the stop-mode debug API
|
sl@0
|
37 |
|
sl@0
|
38 |
@publishedPartner
|
sl@0
|
39 |
@released
|
sl@0
|
40 |
*/
|
sl@0
|
41 |
#ifdef __MEMMODEL_MULTIPLE__
|
sl@0
|
42 |
const TInt KDebuggerMinorVersionNumber = 6;
|
sl@0
|
43 |
#else
|
sl@0
|
44 |
const TInt KDebuggerMinorVersionNumber = 5;
|
sl@0
|
45 |
#endif
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
Defines the build number of the stop-mode debug API
|
sl@0
|
48 |
|
sl@0
|
49 |
@publishedPartner
|
sl@0
|
50 |
@released
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
const TInt KDebuggerBuildVersionNumber = KE32BuildVersionNumber;
|
sl@0
|
53 |
|
sl@0
|
54 |
//
|
sl@0
|
55 |
// Stop mode debugger change flags
|
sl@0
|
56 |
//
|
sl@0
|
57 |
/**
|
sl@0
|
58 |
Flag to indicate that the process container has been modified by the kernel
|
sl@0
|
59 |
|
sl@0
|
60 |
@publishedPartner
|
sl@0
|
61 |
@released
|
sl@0
|
62 |
*/
|
sl@0
|
63 |
const TUint32 KDebuggerChangeProcess = 0x01;
|
sl@0
|
64 |
/**
|
sl@0
|
65 |
Flag to indicate that the thread container has been modified by the kernel
|
sl@0
|
66 |
|
sl@0
|
67 |
@publishedPartner
|
sl@0
|
68 |
@released
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
const TUint32 KDebuggerChangeThread = 0x02;
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
Flag to indicate that the library container has been modified by the kernel
|
sl@0
|
73 |
|
sl@0
|
74 |
@publishedPartner
|
sl@0
|
75 |
@released
|
sl@0
|
76 |
*/
|
sl@0
|
77 |
const TUint32 KDebuggerChangeLibrary = 0x04;
|
sl@0
|
78 |
/**
|
sl@0
|
79 |
Flag to indicate that the chunk container has been modified by the kernel
|
sl@0
|
80 |
|
sl@0
|
81 |
@publishedPartner
|
sl@0
|
82 |
@released
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
const TUint32 KDebuggerChangeChunk = 0x08;
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
Flag to indicate that the code segment list has been modified by the kernel
|
sl@0
|
87 |
|
sl@0
|
88 |
@publishedPartner
|
sl@0
|
89 |
@released
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
const TUint32 KDebuggerChangeCode = 0x10;
|
sl@0
|
92 |
/**
|
sl@0
|
93 |
Flag to indicate that a PDD has been loaded or unloaded by the kernel
|
sl@0
|
94 |
|
sl@0
|
95 |
@publishedPartner
|
sl@0
|
96 |
@released
|
sl@0
|
97 |
*/
|
sl@0
|
98 |
const TUint32 KDebuggerChangePdd = 0x20;
|
sl@0
|
99 |
/**
|
sl@0
|
100 |
Flag to indicate that an LDD has been loaded or unloaded by the kernel
|
sl@0
|
101 |
|
sl@0
|
102 |
@publishedPartner
|
sl@0
|
103 |
@released
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
const TUint32 KDebuggerChangeLdd = 0x40;
|
sl@0
|
106 |
|
sl@0
|
107 |
/**
|
sl@0
|
108 |
Constant used to indicate that the given position in the debug offset
|
sl@0
|
109 |
table is invalid
|
sl@0
|
110 |
|
sl@0
|
111 |
@publishedPartner
|
sl@0
|
112 |
@released
|
sl@0
|
113 |
*/
|
sl@0
|
114 |
const TInt KDebuggerOffsetInvalid = -1;
|
sl@0
|
115 |
|
sl@0
|
116 |
const TUint32 KFilterBufferSize = 1024;
|
sl@0
|
117 |
const TUint32 KFilterBufferSignature = 0x4642444B;
|
sl@0
|
118 |
|
sl@0
|
119 |
/**
|
sl@0
|
120 |
This structure will preceed any filter items in the filter buffer.
|
sl@0
|
121 |
|
sl@0
|
122 |
@publishedPartner
|
sl@0
|
123 |
@prototype
|
sl@0
|
124 |
*/
|
sl@0
|
125 |
struct TFilterHeader
|
sl@0
|
126 |
{
|
sl@0
|
127 |
/**
|
sl@0
|
128 |
Must be set to KFilterBufferSignature for the filter buffer to be valid.
|
sl@0
|
129 |
If not, all events are reported and the filter is off.
|
sl@0
|
130 |
*/
|
sl@0
|
131 |
TUint32 iSignature;
|
sl@0
|
132 |
|
sl@0
|
133 |
enum TFilterFlags
|
sl@0
|
134 |
{
|
sl@0
|
135 |
/** Set if we should notify about global events with no associated name */
|
sl@0
|
136 |
EGlobalEvents = 1 << 0
|
sl@0
|
137 |
};
|
sl@0
|
138 |
|
sl@0
|
139 |
/**
|
sl@0
|
140 |
A bitwise OR of values from the TFilterFlags enum.
|
sl@0
|
141 |
@see TFilterFlags
|
sl@0
|
142 |
*/
|
sl@0
|
143 |
TUint32 iFlags;
|
sl@0
|
144 |
|
sl@0
|
145 |
/**
|
sl@0
|
146 |
Number of filter objects that follow in the buffer
|
sl@0
|
147 |
@see TFilterObject
|
sl@0
|
148 |
*/
|
sl@0
|
149 |
TUint32 iNumItems;
|
sl@0
|
150 |
};
|
sl@0
|
151 |
|
sl@0
|
152 |
/**
|
sl@0
|
153 |
This structure represents an object that the debugger wishes to be notified
|
sl@0
|
154 |
about for certain events. Note these must be word aligned in the filter buffer
|
sl@0
|
155 |
|
sl@0
|
156 |
@publishedPartner
|
sl@0
|
157 |
@prototype
|
sl@0
|
158 |
*/
|
sl@0
|
159 |
struct TFilterObject
|
sl@0
|
160 |
{
|
sl@0
|
161 |
/**
|
sl@0
|
162 |
The set of events for which this filter object applies
|
sl@0
|
163 |
Each bit in iEventMask maps onto each member of enum TKernelEvent.
|
sl@0
|
164 |
ie the Nth bit of iEvent indicates if we are interested in the
|
sl@0
|
165 |
Nth enum in TKernelEvent
|
sl@0
|
166 |
@see TKernelEvent
|
sl@0
|
167 |
*/
|
sl@0
|
168 |
TUint64 iEventMask;
|
sl@0
|
169 |
|
sl@0
|
170 |
/** The length of the name of the filter object */
|
sl@0
|
171 |
TUint32 iLength;
|
sl@0
|
172 |
|
sl@0
|
173 |
/** Spares */
|
sl@0
|
174 |
TUint32 iSpares[8];
|
sl@0
|
175 |
|
sl@0
|
176 |
/** Padding to keep a 32 bit word at end of struct. Must be kept with iName, below*/
|
sl@0
|
177 |
TUint8 iPad[3];
|
sl@0
|
178 |
|
sl@0
|
179 |
/** First character of the filter object name. this extends past the end of the struct */
|
sl@0
|
180 |
TUint8 iName[1];
|
sl@0
|
181 |
};
|
sl@0
|
182 |
|
sl@0
|
183 |
//
|
sl@0
|
184 |
// Forward declarations
|
sl@0
|
185 |
//
|
sl@0
|
186 |
class DDebuggerInfo;
|
sl@0
|
187 |
|
sl@0
|
188 |
/**
|
sl@0
|
189 |
Kernel debugger interface
|
sl@0
|
190 |
|
sl@0
|
191 |
@publishedPartner
|
sl@0
|
192 |
@released
|
sl@0
|
193 |
*/
|
sl@0
|
194 |
class Debugger
|
sl@0
|
195 |
{
|
sl@0
|
196 |
public:
|
sl@0
|
197 |
IMPORT_C static TVersion Version();
|
sl@0
|
198 |
IMPORT_C static TInt Install(DDebuggerInfo* aDebugger);
|
sl@0
|
199 |
IMPORT_C static DDebuggerInfo* DebuggerInfo();
|
sl@0
|
200 |
public:
|
sl@0
|
201 |
static const TInt ObjectOffsetTable[];
|
sl@0
|
202 |
static const TInt VariantObjectOffsetTable[];
|
sl@0
|
203 |
};
|
sl@0
|
204 |
|
sl@0
|
205 |
/**
|
sl@0
|
206 |
Stop-mode debugger interface
|
sl@0
|
207 |
|
sl@0
|
208 |
@publishedPartner
|
sl@0
|
209 |
@released
|
sl@0
|
210 |
*/
|
sl@0
|
211 |
class DDebuggerInfo
|
sl@0
|
212 |
{
|
sl@0
|
213 |
public:
|
sl@0
|
214 |
// construction
|
sl@0
|
215 |
DDebuggerInfo();
|
sl@0
|
216 |
|
sl@0
|
217 |
// Functions to control access to the filter buffer
|
sl@0
|
218 |
inline void LockFilterBuffer();
|
sl@0
|
219 |
void ReleaseFilterBuffer();
|
sl@0
|
220 |
|
sl@0
|
221 |
public:
|
sl@0
|
222 |
// Points to offset table
|
sl@0
|
223 |
const TInt* const iObjectOffsetTable;
|
sl@0
|
224 |
|
sl@0
|
225 |
// Defines the size of the offset table
|
sl@0
|
226 |
TInt iObjectOffsetTableCount;
|
sl@0
|
227 |
const TArmContextElement* const * const iThreadContextTable;
|
sl@0
|
228 |
|
sl@0
|
229 |
TVersion iVersion;
|
sl@0
|
230 |
TVersion iOSVersion;
|
sl@0
|
231 |
Debug::DStopModeExtension* iStopModeExtension;
|
sl@0
|
232 |
|
sl@0
|
233 |
// kernel objects
|
sl@0
|
234 |
volatile TUint32 iChange;
|
sl@0
|
235 |
DObjectCon* const * iContainers;
|
sl@0
|
236 |
DMutex* iCodeSegLock;
|
sl@0
|
237 |
SDblQue* iCodeSegGlobalList;
|
sl@0
|
238 |
TScheduler* iScheduler;
|
sl@0
|
239 |
|
sl@0
|
240 |
// shadow pages
|
sl@0
|
241 |
TPhysAddr* iShadowPages;
|
sl@0
|
242 |
TInt iShadowPageCount;
|
sl@0
|
243 |
|
sl@0
|
244 |
// current thread
|
sl@0
|
245 |
NThread* iCurrentThread;
|
sl@0
|
246 |
|
sl@0
|
247 |
// mask for breakpoint-able event handler
|
sl@0
|
248 |
volatile TUint32 iEventMask[(EEventLimit + 31) >> 5];
|
sl@0
|
249 |
|
sl@0
|
250 |
// breakpoint-able (RAM) address in the event handler
|
sl@0
|
251 |
TLinAddr iEventHandlerBreakpoint;
|
sl@0
|
252 |
|
sl@0
|
253 |
/** Identifies memory model deployed on the target and the content of Debugger::VariantObjectOffsetTable*/
|
sl@0
|
254 |
TMemoryModelType iMemoryModelType;
|
sl@0
|
255 |
|
sl@0
|
256 |
/** Points to variant specific offset table*/
|
sl@0
|
257 |
const TInt* const iMemModelObjectOffsetTable;
|
sl@0
|
258 |
|
sl@0
|
259 |
/** Defines the size of the variant specific offset table*/
|
sl@0
|
260 |
TInt iMemModelObjectOffsetTableCount;
|
sl@0
|
261 |
|
sl@0
|
262 |
/** @prototype Buffer through which the debugger can communicate the filter */
|
sl@0
|
263 |
TUint8* iFilterBuffer;
|
sl@0
|
264 |
|
sl@0
|
265 |
/** @prototype Size of memory allocated to the buffer */
|
sl@0
|
266 |
TUint32 iFilterBufferSize;
|
sl@0
|
267 |
|
sl@0
|
268 |
/** @prototype Lock to control access to the filter buffer */
|
sl@0
|
269 |
volatile TBool iFilterBufferInUse;
|
sl@0
|
270 |
};
|
sl@0
|
271 |
|
sl@0
|
272 |
#endif //__KDEBUG_H__
|