|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include "MemSpyDriverOSAdaption.h" |
|
18 |
|
19 // System includes |
|
20 #include <kern_priv.h> |
|
21 #include <nkern.h> |
|
22 #include <nk_plat.h> |
|
23 |
|
24 #ifdef __MARM__ |
|
25 #include <arm.h> |
|
26 #endif |
|
27 |
|
28 // I've removed UNALIGNED_DATA_MEMBER in preference for just using memcpy to get round the potential unaligned access. -TomS |
|
29 |
|
30 // User includes |
|
31 #include "MemSpyDriverLog.h" |
|
32 #include "MemSpyDriverPAndS.h" |
|
33 #include "MemSpyDriverDevice.h" |
|
34 |
|
35 // Internal constants |
|
36 const TInt KMemSpyLocalThreadDataSizeEstimate = 0x80; // The amount of user stack that MemSpy attempts to scan for the RHeap vTable |
|
37 |
|
38 |
|
39 |
|
40 DMemSpyDriverOSAdaptionDObject::DMemSpyDriverOSAdaptionDObject( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
41 : iOSAdaption( aOSAdaption ) |
|
42 { |
|
43 } |
|
44 |
|
45 |
|
46 TUint8 DMemSpyDriverOSAdaptionDObject::GetContainerID( DObject& aObject ) const |
|
47 { |
|
48 return aObject.iContainerID; |
|
49 } |
|
50 |
|
51 |
|
52 TObjectType DMemSpyDriverOSAdaptionDObject::GetObjectType( DObject& aObject ) const |
|
53 { |
|
54 const TUint8 containerId = GetContainerID( aObject ); |
|
55 const TObjectType ret = static_cast< TObjectType >( containerId - 1 ); |
|
56 return ret; |
|
57 } |
|
58 |
|
59 |
|
60 DObject* DMemSpyDriverOSAdaptionDObject::GetOwner( DObject& aObject ) const |
|
61 { |
|
62 return aObject.iOwner; |
|
63 } |
|
64 |
|
65 |
|
66 DObject* DMemSpyDriverOSAdaptionDObject::GetOwner( DObject& aObject, TUint8 aExpectedContainerId ) const |
|
67 { |
|
68 DObject* owner = GetOwner( aObject ); |
|
69 // |
|
70 const TUint8 containerId = GetContainerID( aObject ) - 1; |
|
71 if ( containerId != aExpectedContainerId ) |
|
72 { |
|
73 owner = NULL; |
|
74 } |
|
75 // |
|
76 return owner; |
|
77 } |
|
78 |
|
79 TInt DMemSpyDriverOSAdaptionDObject::GetAccessCount( DObject& aObject ) const |
|
80 { |
|
81 return aObject.AccessCount(); |
|
82 } |
|
83 |
|
84 TInt DMemSpyDriverOSAdaptionDObject::GetUniqueID( DObject& aObject ) const |
|
85 { |
|
86 return aObject.UniqueID(); |
|
87 } |
|
88 |
|
89 TUint DMemSpyDriverOSAdaptionDObject::GetProtection( DObject& aObject ) const |
|
90 { |
|
91 return aObject.Protection(); |
|
92 } |
|
93 |
|
94 TUint8* DMemSpyDriverOSAdaptionDObject::GetAddressOfKernelOwner( DObject& aObject ) const |
|
95 { |
|
96 return (TUint8*)aObject.Owner(); |
|
97 } |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 DMemSpyDriverOSAdaptionDThread::DMemSpyDriverOSAdaptionDThread( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
110 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
111 { |
|
112 // Get current NThread and map it on to DThread |
|
113 NThread* nThread = NKern::CurrentThread(); |
|
114 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - nThread: 0x%08x", nThread ) ); |
|
115 DThread* dThread = Kern::NThreadToDThread( nThread ); |
|
116 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - dThread: 0x%08x", dThread ) ); |
|
117 |
|
118 // At this point, it should be possible to work out the offset of the NThread within DThread. |
|
119 iOffset_NThread = reinterpret_cast<TUint32>( nThread ) - reinterpret_cast<TUint32>( dThread ); |
|
120 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - difference: 0x%08x", iOffset_NThread ) ); |
|
121 |
|
122 // Work out the delta between compile time and run time |
|
123 TInt delta = iOffset_NThread - _FOFF( DThread, iNThread ); |
|
124 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::Construct() - compile time vs run time offset delta: %d", delta )); |
|
125 |
|
126 // iNThread |
|
127 TRACE( Kern::Printf( "OSA - [DThread::iNThread] compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iNThread), iOffset_NThread )); |
|
128 |
|
129 // iExitType |
|
130 iOffset_ExitType = _FOFF( DThread, iExitType ) + delta; |
|
131 TRACE( Kern::Printf( "OSA - [DThread::iExitType] compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iExitType), iOffset_ExitType )); |
|
132 |
|
133 // iSupervisorStack |
|
134 iOffset_SupervisorStackBase = _FOFF( DThread, iSupervisorStack ) + delta; |
|
135 TRACE( Kern::Printf( "OSA - [DThread::iSupervisorStack] compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iSupervisorStack), iOffset_SupervisorStackBase )); |
|
136 |
|
137 // iSupervisorStackSize |
|
138 iOffset_SupervisorStackSize = _FOFF( DThread, iSupervisorStackSize ) + delta; |
|
139 TRACE( Kern::Printf( "OSA - [DThread::iSupervisorStackSize] compile time offset: 0x%08x, run time offset: 0x%08x", _FOFF(DThread,iSupervisorStackSize), iOffset_SupervisorStackSize )); |
|
140 } |
|
141 |
|
142 |
|
143 NThread* DMemSpyDriverOSAdaptionDThread::GetNThread( DThread& aObject ) const |
|
144 { |
|
145 DThread* dThread = &aObject; |
|
146 TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_NThread; |
|
147 NThread* pRet = reinterpret_cast< NThread* >( pTarget ); |
|
148 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetNThread() - aObject: 0x%08x, ret: 0x%08x", &aObject, pRet ) ); |
|
149 return pRet; |
|
150 } |
|
151 |
|
152 |
|
153 TExitType DMemSpyDriverOSAdaptionDThread::GetExitType( DThread& aObject ) const |
|
154 { |
|
155 DThread* dThread = &aObject; |
|
156 TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_ExitType; |
|
157 TUint8 exitType = *reinterpret_cast<TUint8*>(pTarget); |
|
158 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetExitType() - aObject: 0x%08x, ret: %d", &aObject, (TInt)exitType ) ); |
|
159 return (TExitType)exitType; |
|
160 } |
|
161 |
|
162 |
|
163 TUint32 DMemSpyDriverOSAdaptionDThread::GetSupervisorStackBase( DThread& aObject ) const |
|
164 { |
|
165 DThread* dThread = &aObject; |
|
166 TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_SupervisorStackBase; |
|
167 |
|
168 TUint32 ret; |
|
169 memcpy(&ret, (const TAny*)pTarget, sizeof(TUint32)); |
|
170 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetSupervisorStackBase() - aObject: 0x%08x, ret: 0x%08x", &aObject, ret ) ); |
|
171 return ret; |
|
172 } |
|
173 |
|
174 |
|
175 TInt DMemSpyDriverOSAdaptionDThread::GetSupervisorStackSize( DThread& aObject ) const |
|
176 { |
|
177 DThread* dThread = &aObject; |
|
178 TUint32 pTarget = reinterpret_cast<TUint32>( dThread ) + iOffset_SupervisorStackSize; |
|
179 |
|
180 TInt ret; |
|
181 memcpy(&ret, (const TAny*)pTarget, sizeof(TInt)); |
|
182 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetSupervisorStackSize() - aObject: 0x%08x, ret: %d", &aObject, ret ) ); |
|
183 return ret; |
|
184 } |
|
185 |
|
186 |
|
187 RAllocator* DMemSpyDriverOSAdaptionDThread::GetAllocator( DThread& aObject ) const |
|
188 { |
|
189 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - START" ) ); |
|
190 // |
|
191 RAllocator* ret = aObject.iAllocator; |
|
192 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - allocator: 0x%08x", ret ) ); |
|
193 // |
|
194 if ( ret == NULL ) |
|
195 { |
|
196 TUint32 stackAddress = 0; |
|
197 ret = GetAllocatorAndStackAddress( aObject, stackAddress ); |
|
198 } |
|
199 // |
|
200 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocator() - END - ret: 0x%08x", ret ) ); |
|
201 return ret; |
|
202 } |
|
203 |
|
204 |
|
205 // TODO try to rework this without inspecting the stack! |
|
206 CActiveScheduler* DMemSpyDriverOSAdaptionDThread::GetActiveScheduler( DThread& aObject ) const |
|
207 { |
|
208 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - START" ) ); |
|
209 CActiveScheduler* ret = aObject.iScheduler; |
|
210 // |
|
211 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - scheduler: 0x%08x", ret ) ); |
|
212 if ( ret == NULL ) |
|
213 { |
|
214 // We need the stack address of the heap in order to locate the active scheduler. |
|
215 // Implicitly this means that MemSpy can only list active scheduler contents for threads |
|
216 // that use a default RHeap. This has always been the case, so this is not a functional break. |
|
217 // |
|
218 // Assumed stack layout is something like this: |
|
219 // |
|
220 // stack[0x00403ffc] 0x00000000, vTable: 0x00000000 (offset: 0004) |
|
221 // stack[0x00403ff8] 0x00000000, vTable: 0x00000000 (offset: 0008) |
|
222 // stack[0x00403ff4] 0x00000002, vTable: 0x00000000 (offset: 0012) |
|
223 // stack[0x00403ff0] 0x00000002, vTable: 0x00000000 (offset: 0016) |
|
224 // stack[0x00403fec] 0x00000000, vTable: 0x00000000 (offset: 0020) |
|
225 // stack[0x00403fe8] 0x0000000c, vTable: 0x00000000 (offset: 0024) |
|
226 // stack[0x00403fe4] 0x00600078, vTable: 0x80228938 (offset: 0028) |
|
227 // stack[0x00403fe0] 0x00000001, vTable: 0x00000000 (offset: 0032) |
|
228 // stack[0x00403fdc] 0x00600000, vTable: 0x80268430 (offset: 0036) TLocalThreadData::iTlsHeap RAllocator* 80268428 0034 vtable for RHeap |
|
229 // stack[0x00403fd8] 0x0060009c, vTable: 0x80268394 (offset: 0040) TLocalThreadData::iTrapHandler TTrapHandler 8026838c 0014 vtable for TCleanupTrapHandler |
|
230 // stack[0x00403fd4] 0x00600110, vTable: 0x802682ec (offset: 0044) TLocalThreadData::iScheduler CActiveScheduler* 802682e4 002c vtable for CActiveScheduler |
|
231 // stack[0x00403fd0] 0x00600000, vTable: 0x80268430 (offset: 0048) TLocalThreadData::iHeap RAllocator* 80268428 0034 vtable for RHeap |
|
232 // stack[0x00403fcc] 0x00000000, vTable: 0x00000000 (offset: 0052) |
|
233 // stack[0x00403fc8] 0x00100000, vTable: 0x00000000 (offset: 0056) |
|
234 // |
|
235 // GetAllocatorAndStackAddress() will return the first RHeap* it finds, so this will be iTlsHeap, which |
|
236 // is actually no bad thing as it will hopefully be initialised using an RHeap pointer. |
|
237 // CActiveScheduler* is 8 bytes further on from that. |
|
238 // |
|
239 const TUint32 KOffsetToCActiveScheduler = 8; |
|
240 // |
|
241 TUint32 stackAddress = 0; |
|
242 RAllocator* allocator = GetAllocatorAndStackAddress( aObject, stackAddress ); |
|
243 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - allocator: 0x%08x, stackAddress: 0x%08x", allocator, stackAddress ) ); |
|
244 |
|
245 // This assumes the layout of the thread local data structure, i.e. that the four bytes that follow the |
|
246 // allocator pointer are always the active scheduler pointer. |
|
247 if ( allocator != NULL && stackAddress > 0 ) |
|
248 { |
|
249 TUint32* ptr = reinterpret_cast< TUint32* >( stackAddress - KOffsetToCActiveScheduler ); |
|
250 const TInt r = Kern::ThreadRawRead( &aObject, ptr, &ret, sizeof( ret ) ); |
|
251 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - stack address containing scheduler pointer: 0x%08x, read result: %d, CActiveScheduler*: 0x%08x", ptr, r, ret ) ); |
|
252 if ( r != KErrNone ) |
|
253 { |
|
254 ret = NULL; |
|
255 } |
|
256 } |
|
257 } |
|
258 // |
|
259 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetActiveScheduler() - END - ret: 0x%08x", ret ) ); |
|
260 return ret; |
|
261 } |
|
262 |
|
263 |
|
264 TUint32 DMemSpyDriverOSAdaptionDThread::GetUserStackBase( DThread& aObject ) const |
|
265 { |
|
266 return aObject.iUserStackRunAddress; |
|
267 } |
|
268 |
|
269 |
|
270 TInt DMemSpyDriverOSAdaptionDThread::GetUserStackSize( DThread& aObject ) const |
|
271 { |
|
272 return aObject.iUserStackSize; |
|
273 } |
|
274 |
|
275 |
|
276 DProcess* DMemSpyDriverOSAdaptionDThread::GetOwningProcess( DThread& aObject ) const |
|
277 { |
|
278 return aObject.iOwningProcess; |
|
279 } |
|
280 |
|
281 |
|
282 TUint DMemSpyDriverOSAdaptionDThread::GetId( DThread& aObject ) const |
|
283 { |
|
284 return aObject.iId; |
|
285 } |
|
286 |
|
287 |
|
288 MemSpyObjectIx* DMemSpyDriverOSAdaptionDThread::GetHandles( DThread& aObject ) const |
|
289 { |
|
290 MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Thread( aObject ); |
|
291 return handles; |
|
292 } |
|
293 |
|
294 |
|
295 TUint DMemSpyDriverOSAdaptionDThread::GetOwningProcessId( DThread& aObject ) const |
|
296 { |
|
297 DProcess* process = GetOwningProcess( aObject ); |
|
298 TUint ret = 0; |
|
299 // |
|
300 if ( process ) |
|
301 { |
|
302 ret = OSAdaption().DProcess().GetId( *process ); |
|
303 } |
|
304 // |
|
305 return ret; |
|
306 } |
|
307 |
|
308 |
|
309 TInt DMemSpyDriverOSAdaptionDThread::GetPriority( DThread& aObject ) const |
|
310 { |
|
311 return aObject.iThreadPriority; |
|
312 } |
|
313 |
|
314 |
|
315 TUint8* DMemSpyDriverOSAdaptionDThread::GetAddressOfOwningProcess( DThread& aObject ) const |
|
316 { |
|
317 return (TUint8*)aObject.iOwningProcess; |
|
318 } |
|
319 |
|
320 |
|
321 void DMemSpyDriverOSAdaptionDThread::GetNameOfOwningProcess( DThread& aObject, TDes& aName ) const |
|
322 { |
|
323 if ( aObject.iOwningProcess ) |
|
324 { |
|
325 aObject.iOwningProcess->FullName( aName ); |
|
326 } |
|
327 } |
|
328 |
|
329 // TODO re-work this without inspecting the stack. |
|
330 // In particular we can get the allocator from the DThread object's iAllocator object |
|
331 RAllocator* DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress( DThread& aThread, TUint32& aStackAddress ) const |
|
332 { |
|
333 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - START for aThread 0x%08x with ID %d", &aThread, aThread.iId ) ); |
|
334 // |
|
335 aStackAddress = 0; |
|
336 RAllocator* ret = NULL; |
|
337 |
|
338 // We will assume the thread is running and that the user-side stack has been set up |
|
339 // accordingly. |
|
340 const TUint32 base = GetUserStackBase( aThread ); |
|
341 const TInt size = GetUserStackSize( aThread ); |
|
342 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - base: 0x%08x, size: %d, KMemSpyLocalThreadDataSizeEstimate: %d", base, size, KMemSpyLocalThreadDataSizeEstimate ) ); |
|
343 const TUint32 top = base + size; |
|
344 |
|
345 // This is the RHeap vtable we are looking for |
|
346 const TUint32 rHeapVTable = OSAdaption().Device().RHeapVTable(); |
|
347 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - rHeapVTable: 0x%08x", rHeapVTable ) ); |
|
348 // |
|
349 TInt r = KErrNone; |
|
350 |
|
351 #ifdef TRACE_TYPE_GENERAL |
|
352 for( TUint32 addr = top - 4; addr >= top - KMemSpyLocalThreadDataSizeEstimate; addr -= 4 ) |
|
353 { |
|
354 TUint32 value = 0; |
|
355 TUint32 possibleVTable = 0; |
|
356 // |
|
357 TUint32* ptr = reinterpret_cast< TUint32* >( addr ); |
|
358 // |
|
359 r = Kern::ThreadRawRead( &aThread, ptr, &value, sizeof( value ) ); |
|
360 if ( r == KErrNone ) |
|
361 { |
|
362 r = Kern::ThreadRawRead( &aThread, reinterpret_cast< const TAny* >( value ), &possibleVTable, sizeof( possibleVTable ) ); |
|
363 } |
|
364 |
|
365 if ( r == KErrNone ) |
|
366 { |
|
367 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - stack[0x%08x] 0x%08x, vTable: 0x%08x (offset: %04d)", addr, value, possibleVTable, top - addr ) ); |
|
368 } |
|
369 else |
|
370 { |
|
371 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - stack[0x%08x] 0x%08x, (offset: %04d) read failed: %d", addr, value, top - addr, r ) ); |
|
372 } |
|
373 } |
|
374 #endif |
|
375 |
|
376 for( TUint32 addr = top - 4; addr >= top - KMemSpyLocalThreadDataSizeEstimate; addr -= 4 ) |
|
377 { |
|
378 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - addr to read from: 0x%08x", addr ) ); |
|
379 TUint32 value = 0; |
|
380 // |
|
381 TUint32* ptr = reinterpret_cast< TUint32* >( addr ); |
|
382 // |
|
383 r = Kern::ThreadRawRead( &aThread, ptr, &value, sizeof( value ) ); |
|
384 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - read from: 0x%08x, result: %d, value: 0x%08x", addr, r, value ) ); |
|
385 // |
|
386 if ( r == KErrNone ) |
|
387 { |
|
388 // Try and read from the address which is now stored within 'value'. We must do this because |
|
389 // the TLD class holds an RAllocator* and we need to ascertain the vTable of the RAllocator* matches the |
|
390 // only supported vTable that MemSpy understands (RHeap*). |
|
391 TUint32 possibleVTable = 0; |
|
392 r = Kern::ThreadRawRead( &aThread, reinterpret_cast< const TAny* >( value ), &possibleVTable, sizeof( possibleVTable ) ); |
|
393 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - possible vtable read from: 0x%08x, result: %d, possibleVTable: 0x%08x", value, r, possibleVTable ) ); |
|
394 if ( r == KErrNone && possibleVTable == rHeapVTable ) |
|
395 { |
|
396 aStackAddress = addr; |
|
397 ret = reinterpret_cast< RAllocator* >( value ); |
|
398 break; |
|
399 } |
|
400 } |
|
401 } |
|
402 // |
|
403 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDThread::GetAllocatorAndStackAddress() - END - ret: 0x%08x, aStackAddress: 0x%08x", ret, aStackAddress ) ); |
|
404 return ret; |
|
405 } |
|
406 |
|
407 |
|
408 TBool DMemSpyDriverOSAdaptionDThread::IsHandleIndexValid( DThread& aObject ) const |
|
409 { |
|
410 MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Thread( aObject ); |
|
411 return ( handles != NULL ); |
|
412 } |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 DMemSpyDriverOSAdaptionDProcess::DMemSpyDriverOSAdaptionDProcess( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
427 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
428 { |
|
429 } |
|
430 |
|
431 |
|
432 TUint DMemSpyDriverOSAdaptionDProcess::GetId( DProcess& aObject ) const |
|
433 { |
|
434 TRACE( Kern::Printf( "DMemSpyDriverOSAdaptionDProcess::GetId() - value: %d", aObject.iId ) ); |
|
435 return aObject.iId; |
|
436 } |
|
437 |
|
438 |
|
439 MemSpyObjectIx* DMemSpyDriverOSAdaptionDProcess::GetHandles( DProcess& aObject ) const |
|
440 { |
|
441 MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Process( aObject ); |
|
442 return handles; |
|
443 } |
|
444 |
|
445 |
|
446 TExitType DMemSpyDriverOSAdaptionDProcess::GetExitType( DProcess& aObject ) const |
|
447 { |
|
448 return static_cast< TExitType >( aObject.iExitType ); |
|
449 } |
|
450 |
|
451 |
|
452 DThread* DMemSpyDriverOSAdaptionDProcess::OpenFirstThread( DProcess& aProcess ) const |
|
453 { |
|
454 // It appears that the system lock needs to be held while manipulating the iThreadQ |
|
455 DThread* result = NULL; |
|
456 NKern::LockSystem(); |
|
457 // We don't use DProcess::FirstThread() as that doesn't appear to do any checking of whether the list is empty, ie if there are no threads at all |
|
458 SDblQueLink* threadLink = aProcess.iThreadQ.First(); |
|
459 if (threadLink != NULL && threadLink != &aProcess.iThreadQ.iA) |
|
460 { |
|
461 result = _LOFF(threadLink,DThread,iProcessLink); |
|
462 if (result->Open() != KErrNone) |
|
463 { |
|
464 result = NULL; |
|
465 } |
|
466 } |
|
467 NKern::UnlockSystem(); |
|
468 return result; |
|
469 } |
|
470 |
|
471 |
|
472 TUint32 DMemSpyDriverOSAdaptionDProcess::GetSID( DProcess& aObject ) const |
|
473 { |
|
474 return GetSecurityInfo( aObject ).iSecureId; |
|
475 } |
|
476 |
|
477 |
|
478 TUint DMemSpyDriverOSAdaptionDProcess::GetSecurityZone( DProcess& aObject ) const |
|
479 { |
|
480 return aObject.iSecurityZone; |
|
481 } |
|
482 |
|
483 |
|
484 SSecurityInfo& DMemSpyDriverOSAdaptionDProcess::GetSecurityInfo( DProcess& aObject ) const |
|
485 { |
|
486 return aObject.iS; |
|
487 } |
|
488 |
|
489 |
|
490 TInt DMemSpyDriverOSAdaptionDProcess::GetFlags( DProcess& aObject ) const |
|
491 { |
|
492 return aObject.iFlags; |
|
493 } |
|
494 |
|
495 |
|
496 TInt DMemSpyDriverOSAdaptionDProcess::GetGeneration( DProcess& aObject ) const |
|
497 { |
|
498 return aObject.iGeneration; |
|
499 } |
|
500 |
|
501 |
|
502 SDblQue& DMemSpyDriverOSAdaptionDProcess::GetThreadQueue( DProcess& aObject ) const |
|
503 { |
|
504 return aObject.iThreadQ; |
|
505 } |
|
506 |
|
507 |
|
508 DThread* DMemSpyDriverOSAdaptionDProcess::GetThread( SDblQueLink* aLink ) const |
|
509 { |
|
510 DThread* ret = _LOFF( aLink, DThread, iProcessLink ); |
|
511 return ret; |
|
512 } |
|
513 |
|
514 |
|
515 void DMemSpyDriverOSAdaptionDProcess::SetSID( DProcess& aObject, TUint32 aSID ) const |
|
516 { |
|
517 GetSecurityInfo( aObject ).iSecureId = aSID; |
|
518 } |
|
519 |
|
520 |
|
521 void DMemSpyDriverOSAdaptionDProcess::SetSecurityZone( DProcess& aObject, TUint aSecurityZone ) const |
|
522 { |
|
523 aObject.iSecurityZone = aSecurityZone; |
|
524 } |
|
525 |
|
526 |
|
527 TBool DMemSpyDriverOSAdaptionDProcess::IsHandleIndexValid( DProcess& aObject ) const |
|
528 { |
|
529 MemSpyObjectIx* handles = MemSpyObjectIx_GetHandlePointer_Process( aObject ); |
|
530 return ( handles != NULL ); |
|
531 } |
|
532 |
|
533 |
|
534 TUint DMemSpyDriverOSAdaptionDProcess::GetCreatorId( DProcess& aObject ) const |
|
535 { |
|
536 return aObject.iCreatorId; |
|
537 } |
|
538 |
|
539 |
|
540 TInt DMemSpyDriverOSAdaptionDProcess::GetAttributes( DProcess& aObject ) const |
|
541 { |
|
542 return aObject.iAttributes; |
|
543 } |
|
544 |
|
545 |
|
546 TInt DMemSpyDriverOSAdaptionDProcess::GetPriority( DProcess& aObject ) const |
|
547 { |
|
548 return aObject.iPriority; |
|
549 } |
|
550 |
|
551 |
|
552 TUint8* DMemSpyDriverOSAdaptionDProcess::GetAddressOfOwningProcess( DProcess& aObject ) const |
|
553 { |
|
554 return (TUint8*)aObject.iOwningProcess; |
|
555 } |
|
556 |
|
557 |
|
558 TUint8* DMemSpyDriverOSAdaptionDProcess::GetAddressOfDataBssStackChunk( DProcess& aObject ) const |
|
559 { |
|
560 return (TUint8*)aObject.iDataBssStackChunk; |
|
561 } |
|
562 |
|
563 TBool DMemSpyDriverOSAdaptionDProcess::IsKernProcess(DProcess& aProcess) const |
|
564 { |
|
565 // The kernel process always has pid 1 |
|
566 return GetId(aProcess) == 1; |
|
567 } |
|
568 |
|
569 |
|
570 |
|
571 DMemSpyDriverOSAdaptionDChunk::DMemSpyDriverOSAdaptionDChunk( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
572 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
573 { |
|
574 } |
|
575 |
|
576 |
|
577 TInt DMemSpyDriverOSAdaptionDChunk::GetSize( DChunk& aObject ) const |
|
578 { |
|
579 return aObject.Size(); |
|
580 } |
|
581 |
|
582 |
|
583 TInt DMemSpyDriverOSAdaptionDChunk::GetMaxSize( DChunk& aObject ) const |
|
584 { |
|
585 return aObject.MaxSize(); |
|
586 } |
|
587 |
|
588 |
|
589 TUint8* DMemSpyDriverOSAdaptionDChunk::GetBase( DChunk& aChunk ) const |
|
590 { |
|
591 TUint8* base = aChunk.Base(); |
|
592 if (base == 0) |
|
593 { |
|
594 // Under flexible memory model, DChunk::Base() will return NULL (for non-fixed chunks anyway, and that means most of them) |
|
595 // A more useful thing to return is the base address in the owning process |
|
596 DProcess* proc = GetOwningProcess(aChunk); |
|
597 NKern::ThreadEnterCS(); |
|
598 if (proc && proc->Open() == KErrNone) |
|
599 { |
|
600 // Probably shouldn't call ChunkUserBase for a non-user-owned chunk |
|
601 if (!OSAdaption().DProcess().IsKernProcess(*proc)) |
|
602 { |
|
603 DThread* firstThread = OSAdaption().DProcess().OpenFirstThread(*proc); |
|
604 if (firstThread) |
|
605 { |
|
606 base = Kern::ChunkUserBase(&aChunk, firstThread); |
|
607 firstThread->Close(NULL); |
|
608 } |
|
609 } |
|
610 proc->Close(NULL); |
|
611 } |
|
612 NKern::ThreadLeaveCS(); |
|
613 } |
|
614 return base; |
|
615 } |
|
616 |
|
617 |
|
618 DProcess* DMemSpyDriverOSAdaptionDChunk::GetOwningProcess( DChunk& aObject ) const |
|
619 { |
|
620 return aObject.OwningProcess(); |
|
621 } |
|
622 |
|
623 |
|
624 TUint DMemSpyDriverOSAdaptionDChunk::GetOwningProcessId( DChunk& aObject ) const |
|
625 { |
|
626 TUint ret = 0; |
|
627 // |
|
628 DProcess* process = GetOwningProcess( aObject ); |
|
629 if ( process ) |
|
630 { |
|
631 ret = OSAdaption().DProcess().GetId( *process ); |
|
632 } |
|
633 // |
|
634 return ret; |
|
635 } |
|
636 |
|
637 |
|
638 TUint DMemSpyDriverOSAdaptionDChunk::GetControllingOwnerId( DChunk& aObject ) const |
|
639 { |
|
640 return aObject.iControllingOwner; |
|
641 } |
|
642 |
|
643 |
|
644 TChunkType DMemSpyDriverOSAdaptionDChunk::GetType( DChunk& aObject ) const |
|
645 { |
|
646 return aObject.iChunkType; |
|
647 } |
|
648 |
|
649 |
|
650 TInt DMemSpyDriverOSAdaptionDChunk::GetAttributes( DChunk& aObject ) const |
|
651 { |
|
652 return aObject.iAttributes; |
|
653 } |
|
654 |
|
655 |
|
656 TUint8* DMemSpyDriverOSAdaptionDChunk::GetAddressOfOwningProcess( DChunk& aObject ) const |
|
657 { |
|
658 return (TUint8*)aObject.iOwningProcess; |
|
659 } |
|
660 |
|
661 |
|
662 TInt DMemSpyDriverOSAdaptionDChunk::GetBottom( DChunk& aObject ) const |
|
663 { |
|
664 return aObject.Bottom(); |
|
665 } |
|
666 |
|
667 |
|
668 TInt DMemSpyDriverOSAdaptionDChunk::GetTop( DChunk& aObject ) const |
|
669 { |
|
670 return aObject.Top(); |
|
671 } |
|
672 |
|
673 |
|
674 TInt DMemSpyDriverOSAdaptionDChunk::GetStartPos( DChunk& aObject ) const |
|
675 { |
|
676 return aObject.iStartPos; |
|
677 } |
|
678 |
|
679 |
|
680 TUint DMemSpyDriverOSAdaptionDChunk::GetRestrictions( DChunk& aObject ) const |
|
681 { |
|
682 return aObject.iRestrictions; |
|
683 } |
|
684 |
|
685 |
|
686 TUint DMemSpyDriverOSAdaptionDChunk::GetMapAttr( DChunk& aObject ) const |
|
687 { |
|
688 return aObject.iMapAttr; |
|
689 } |
|
690 |
|
691 |
|
692 void DMemSpyDriverOSAdaptionDChunk::GetNameOfOwningProcess( DChunk& aObject, TDes& aName ) const |
|
693 { |
|
694 if ( aObject.OwningProcess() ) |
|
695 { |
|
696 aObject.OwningProcess()->FullName( aName ); |
|
697 } |
|
698 } |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 DMemSpyDriverOSAdaptionDServer::DMemSpyDriverOSAdaptionDServer( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
718 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
719 { |
|
720 } |
|
721 |
|
722 |
|
723 SDblQue& DMemSpyDriverOSAdaptionDServer::GetSessionQueue( DServer& aObject ) const |
|
724 { |
|
725 return aObject.iSessionQ; |
|
726 } |
|
727 |
|
728 |
|
729 DSession* DMemSpyDriverOSAdaptionDServer::GetSession( SDblQueLink* aLink ) const |
|
730 { |
|
731 DSession* session = _LOFF( aLink, DSession, iServerLink ); |
|
732 return session; |
|
733 } |
|
734 |
|
735 |
|
736 TInt DMemSpyDriverOSAdaptionDServer::GetSessionCount( DServer& aObject ) const |
|
737 { |
|
738 TInt ret = 0; |
|
739 // |
|
740 SDblQueLink* anchor = &aObject.iSessionQ.iA; |
|
741 SDblQueLink* link = aObject.iSessionQ.First(); |
|
742 // |
|
743 while( link != anchor) |
|
744 { |
|
745 ++ret; |
|
746 link = link->iNext; |
|
747 } |
|
748 // |
|
749 return ret; |
|
750 } |
|
751 |
|
752 |
|
753 DThread* DMemSpyDriverOSAdaptionDServer::GetOwningThread( DServer& aObject ) const |
|
754 { |
|
755 return aObject.iOwningThread; |
|
756 } |
|
757 |
|
758 |
|
759 TUint DMemSpyDriverOSAdaptionDServer::GetOwningThreadId( DServer& aObject ) const |
|
760 { |
|
761 TUint ret = 0; |
|
762 // |
|
763 DThread* thread = GetOwningThread( aObject ); |
|
764 if ( thread ) |
|
765 { |
|
766 ret = OSAdaption().DThread().GetId( *thread ); |
|
767 } |
|
768 // |
|
769 return ret; |
|
770 } |
|
771 |
|
772 |
|
773 TIpcSessionType DMemSpyDriverOSAdaptionDServer::GetSessionType( DServer& aObject ) const |
|
774 { |
|
775 return static_cast< TIpcSessionType >( aObject.iSessionType ); |
|
776 } |
|
777 |
|
778 |
|
779 TUint8* DMemSpyDriverOSAdaptionDServer::GetAddressOfOwningThread( DServer& aObject ) const |
|
780 { |
|
781 return (TUint8*)aObject.iOwningThread; |
|
782 } |
|
783 |
|
784 |
|
785 void DMemSpyDriverOSAdaptionDServer::GetNameOfOwningThread( DServer& aObject, TDes& aName ) const |
|
786 { |
|
787 if ( aObject.iOwningThread ) |
|
788 { |
|
789 aObject.iOwningThread->FullName( aName ); |
|
790 } |
|
791 } |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 DMemSpyDriverOSAdaptionDSession::DMemSpyDriverOSAdaptionDSession( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
805 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
806 { |
|
807 } |
|
808 |
|
809 |
|
810 TIpcSessionType DMemSpyDriverOSAdaptionDSession::GetSessionType( DSession& aObject ) const |
|
811 { |
|
812 return static_cast< TIpcSessionType >( aObject.iSessionType ); |
|
813 } |
|
814 |
|
815 |
|
816 DServer* DMemSpyDriverOSAdaptionDSession::GetServer( DSession& aObject ) const |
|
817 { |
|
818 return aObject.iServer; |
|
819 } |
|
820 |
|
821 |
|
822 TUint8* DMemSpyDriverOSAdaptionDSession::GetAddressOfServer( DSession& aObject ) const |
|
823 { |
|
824 return (TUint8*)aObject.iServer; |
|
825 } |
|
826 |
|
827 |
|
828 TUint16 DMemSpyDriverOSAdaptionDSession::GetTotalAccessCount( DSession& aObject ) const |
|
829 { |
|
830 return aObject.iTotalAccessCount; |
|
831 } |
|
832 |
|
833 |
|
834 TUint8 DMemSpyDriverOSAdaptionDSession::GetSrvSessionType( DSession& aObject ) const |
|
835 { |
|
836 return aObject.iSvrSessionType; |
|
837 } |
|
838 |
|
839 |
|
840 TInt DMemSpyDriverOSAdaptionDSession::GetMsgCount( DSession& aObject ) const |
|
841 { |
|
842 return aObject.iMsgCount; |
|
843 } |
|
844 |
|
845 |
|
846 TInt DMemSpyDriverOSAdaptionDSession::GetMsgLimit( DSession& aObject ) const |
|
847 { |
|
848 return aObject.iMsgLimit; |
|
849 } |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 DMemSpyDriverOSAdaptionDCodeSeg::DMemSpyDriverOSAdaptionDCodeSeg( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
867 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
868 { |
|
869 } |
|
870 |
|
871 |
|
872 DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSeg( SDblQueLink* aLink ) const |
|
873 { |
|
874 DCodeSeg* ret = _LOFF( aLink, DCodeSeg, iTempLink ); |
|
875 return ret; |
|
876 } |
|
877 |
|
878 |
|
879 DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSeg( DLibrary& aLibrary ) const |
|
880 { |
|
881 return aLibrary.iCodeSeg; |
|
882 } |
|
883 |
|
884 |
|
885 DCodeSeg* DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSegFromHandle( TAny* aHandle ) const |
|
886 { |
|
887 DCodeSeg* ret = DCodeSeg::VerifyHandle( aHandle ); |
|
888 return ret; |
|
889 } |
|
890 |
|
891 |
|
892 TBool DMemSpyDriverOSAdaptionDCodeSeg::GetIsXIP( DCodeSeg& aCodeSeg ) const |
|
893 { |
|
894 TBool ret = ETrue; |
|
895 // |
|
896 #ifdef __WINS__ |
|
897 (void) aCodeSeg; |
|
898 #else |
|
899 DEpocCodeSeg& epocCodeSegment = static_cast< DEpocCodeSeg& >( aCodeSeg ); |
|
900 ret = ( epocCodeSegment.iXIP != 0 ); |
|
901 #endif |
|
902 // |
|
903 return ret; |
|
904 } |
|
905 |
|
906 |
|
907 TInt DMemSpyDriverOSAdaptionDCodeSeg::GetCodeSegQueue( DProcess& aObject, SDblQue& aQueue ) const |
|
908 { |
|
909 const TInt count = aObject.TraverseCodeSegs( &aQueue, NULL, DCodeSeg::EMarkDebug, DProcess::ETraverseFlagAdd ); |
|
910 return count; |
|
911 } |
|
912 |
|
913 |
|
914 void DMemSpyDriverOSAdaptionDCodeSeg::EmptyCodeSegQueue( SDblQue& aQueue ) const |
|
915 { |
|
916 DCodeSeg::EmptyQueue( aQueue, DCodeSeg::EMarkDebug ); |
|
917 } |
|
918 |
|
919 |
|
920 TUint32 DMemSpyDriverOSAdaptionDCodeSeg::GetSize( DCodeSeg& aCodeSeg ) const |
|
921 { |
|
922 return aCodeSeg.iSize; |
|
923 } |
|
924 |
|
925 |
|
926 void DMemSpyDriverOSAdaptionDCodeSeg::GetCreateInfo( DCodeSeg& aCodeSeg, TCodeSegCreateInfo& aInfo ) const |
|
927 { |
|
928 aCodeSeg.Info( aInfo ); |
|
929 } |
|
930 |
|
931 |
|
932 TUint8 DMemSpyDriverOSAdaptionDCodeSeg::GetState( DLibrary& aLibrary ) const |
|
933 { |
|
934 return aLibrary.iState; |
|
935 } |
|
936 |
|
937 |
|
938 TInt DMemSpyDriverOSAdaptionDCodeSeg::GetMapCount( DLibrary& aLibrary ) const |
|
939 { |
|
940 return aLibrary.iMapCount; |
|
941 } |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 DMemSpyDriverOSAdaptionDSemaphore::DMemSpyDriverOSAdaptionDSemaphore( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
960 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
961 { |
|
962 } |
|
963 |
|
964 |
|
965 TInt DMemSpyDriverOSAdaptionDSemaphore::GetCount( DSemaphore& aObject ) const |
|
966 { |
|
967 return aObject.iCount; |
|
968 } |
|
969 |
|
970 |
|
971 TUint8 DMemSpyDriverOSAdaptionDSemaphore::GetResetting( DSemaphore& aObject ) const |
|
972 { |
|
973 return aObject.iResetting; |
|
974 } |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 DMemSpyDriverOSAdaptionDMutex::DMemSpyDriverOSAdaptionDMutex( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
994 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
995 { |
|
996 } |
|
997 |
|
998 |
|
999 TInt DMemSpyDriverOSAdaptionDMutex::GetHoldCount( DMutex& aObject ) const |
|
1000 { |
|
1001 return aObject.iHoldCount; |
|
1002 } |
|
1003 |
|
1004 |
|
1005 TInt DMemSpyDriverOSAdaptionDMutex::GetWaitCount( DMutex& aObject ) const |
|
1006 { |
|
1007 return aObject.iWaitCount; |
|
1008 } |
|
1009 |
|
1010 |
|
1011 TUint8 DMemSpyDriverOSAdaptionDMutex::GetResetting( DMutex& aObject ) const |
|
1012 { |
|
1013 return aObject.iResetting; |
|
1014 } |
|
1015 |
|
1016 |
|
1017 TUint8 DMemSpyDriverOSAdaptionDMutex::GetOrder( DMutex& aObject ) const |
|
1018 { |
|
1019 return aObject.iOrder; |
|
1020 } |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 DMemSpyDriverOSAdaptionDLogicalDevice::DMemSpyDriverOSAdaptionDLogicalDevice( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1031 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1032 { |
|
1033 } |
|
1034 |
|
1035 |
|
1036 TInt DMemSpyDriverOSAdaptionDLogicalDevice::GetOpenChannels( DLogicalDevice& aObject ) const |
|
1037 { |
|
1038 return aObject.iOpenChannels; |
|
1039 } |
|
1040 |
|
1041 |
|
1042 TVersion DMemSpyDriverOSAdaptionDLogicalDevice::GetVersion( DLogicalDevice& aObject ) const |
|
1043 { |
|
1044 return aObject.iVersion; |
|
1045 } |
|
1046 |
|
1047 |
|
1048 TUint DMemSpyDriverOSAdaptionDLogicalDevice::GetParseMask( DLogicalDevice& aObject ) const |
|
1049 { |
|
1050 return aObject.iParseMask; |
|
1051 } |
|
1052 |
|
1053 |
|
1054 TUint DMemSpyDriverOSAdaptionDLogicalDevice::GetUnitsMask( DLogicalDevice& aObject ) const |
|
1055 { |
|
1056 return aObject.iUnitsMask; |
|
1057 } |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 DMemSpyDriverOSAdaptionDPhysicalDevice::DMemSpyDriverOSAdaptionDPhysicalDevice( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1076 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1077 { |
|
1078 } |
|
1079 |
|
1080 |
|
1081 TVersion DMemSpyDriverOSAdaptionDPhysicalDevice::GetVersion( DPhysicalDevice& aObject ) const |
|
1082 { |
|
1083 return aObject.iVersion; |
|
1084 } |
|
1085 |
|
1086 |
|
1087 TUint DMemSpyDriverOSAdaptionDPhysicalDevice::GetUnitsMask( DPhysicalDevice& aObject ) const |
|
1088 { |
|
1089 return aObject.iUnitsMask; |
|
1090 } |
|
1091 |
|
1092 |
|
1093 TUint8* DMemSpyDriverOSAdaptionDPhysicalDevice::GetAddressOfCodeSeg( DPhysicalDevice& aObject ) const |
|
1094 { |
|
1095 return (TUint8*)aObject.iCodeSeg; |
|
1096 } |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 DMemSpyDriverOSAdaptionDChangeNotifier::DMemSpyDriverOSAdaptionDChangeNotifier( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1115 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1116 { |
|
1117 } |
|
1118 |
|
1119 |
|
1120 TUint DMemSpyDriverOSAdaptionDChangeNotifier::GetChanges( DChangeNotifier& aObject ) const |
|
1121 { |
|
1122 return aObject.iChanges; |
|
1123 } |
|
1124 |
|
1125 |
|
1126 TUint8* DMemSpyDriverOSAdaptionDChangeNotifier::GetAddressOfOwningThread( DChangeNotifier& aObject ) const |
|
1127 { |
|
1128 return (TUint8*)aObject.iThread; |
|
1129 } |
|
1130 |
|
1131 |
|
1132 void DMemSpyDriverOSAdaptionDChangeNotifier::GetNameOfOwningThread( DChangeNotifier& aObject, TDes& aName ) const |
|
1133 { |
|
1134 if ( aObject.iThread ) |
|
1135 { |
|
1136 aObject.iThread->FullName( aName ); |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 DMemSpyDriverOSAdaptionDUndertaker::DMemSpyDriverOSAdaptionDUndertaker( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1156 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1157 { |
|
1158 } |
|
1159 |
|
1160 |
|
1161 TUint8* DMemSpyDriverOSAdaptionDUndertaker::GetAddressOfOwningThread( DUndertaker& aObject ) const |
|
1162 { |
|
1163 return (TUint8*)aObject.iOwningThread; |
|
1164 } |
|
1165 |
|
1166 |
|
1167 void DMemSpyDriverOSAdaptionDUndertaker::GetNameOfOwningThread( DUndertaker& aObject, TDes& aName ) const |
|
1168 { |
|
1169 if ( aObject.iOwningThread ) |
|
1170 { |
|
1171 aObject.iOwningThread->FullName( aName ); |
|
1172 } |
|
1173 } |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 DMemSpyDriverOSAdaptionDCondVar::DMemSpyDriverOSAdaptionDCondVar( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1192 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1193 { |
|
1194 } |
|
1195 |
|
1196 |
|
1197 TUint8 DMemSpyDriverOSAdaptionDCondVar::GetResetting( DCondVar& aObject ) const |
|
1198 { |
|
1199 return aObject.iResetting; |
|
1200 } |
|
1201 |
|
1202 |
|
1203 TUint8* DMemSpyDriverOSAdaptionDCondVar::GetAddressOfMutex( DCondVar& aObject ) const |
|
1204 { |
|
1205 return (TUint8*)aObject.iMutex; |
|
1206 } |
|
1207 |
|
1208 |
|
1209 void DMemSpyDriverOSAdaptionDCondVar::GetNameOfMutex( DCondVar& aObject, TDes& aName ) const |
|
1210 { |
|
1211 if ( aObject.iMutex ) |
|
1212 { |
|
1213 aObject.iMutex->FullName( aName ); |
|
1214 } |
|
1215 } |
|
1216 |
|
1217 |
|
1218 TInt DMemSpyDriverOSAdaptionDCondVar::GetWaitCount( DCondVar& aObject ) const |
|
1219 { |
|
1220 return aObject.iWaitCount; |
|
1221 } |
|
1222 |
|
1223 |
|
1224 SDblQue& DMemSpyDriverOSAdaptionDCondVar::GetSuspendedQ( DCondVar& aObject ) const |
|
1225 { |
|
1226 return aObject.iSuspendedQ; |
|
1227 } |
|
1228 |
|
1229 |
|
1230 DThread* DMemSpyDriverOSAdaptionDCondVar::GetThread( SDblQueLink* aLink ) const |
|
1231 { |
|
1232 DThread* thread = _LOFF( aLink, DThread, iWaitLink ); |
|
1233 return thread; |
|
1234 } |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 DMemSpyDriverOSAdaptionDTimer::DMemSpyDriverOSAdaptionDTimer( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1251 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1252 { |
|
1253 } |
|
1254 |
|
1255 |
|
1256 TTimer::TTimerType DMemSpyDriverOSAdaptionDTimer::GetType( DTimer& aObject ) const |
|
1257 { |
|
1258 const TTimer::TTimerType ret = aObject.iTimer.Type(); |
|
1259 return ret; |
|
1260 } |
|
1261 |
|
1262 |
|
1263 TTimer::TTimerState DMemSpyDriverOSAdaptionDTimer::GetState( DTimer& aObject ) const |
|
1264 { |
|
1265 const TTimer::TTimerState ret = static_cast<TTimer::TTimerState>( aObject.iTimer.iState ); |
|
1266 return ret; |
|
1267 } |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 DMemSpyDriverOSAdaptionDPropertyRef::DMemSpyDriverOSAdaptionDPropertyRef( DMemSpyDriverOSAdaption& aOSAdaption ) |
|
1283 : DMemSpyDriverOSAdaptionDObject( aOSAdaption ) |
|
1284 { |
|
1285 } |
|
1286 |
|
1287 |
|
1288 TBool DMemSpyDriverOSAdaptionDPropertyRef::GetIsReady( DObject& aObject ) const |
|
1289 { |
|
1290 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1291 return ( prop != NULL ); |
|
1292 } |
|
1293 |
|
1294 |
|
1295 RProperty::TType DMemSpyDriverOSAdaptionDPropertyRef::GetType( DObject& aObject ) const |
|
1296 { |
|
1297 RProperty::TType ret = RProperty::EInt; |
|
1298 // |
|
1299 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1300 if ( prop ) |
|
1301 { |
|
1302 ret = (RProperty::TType) prop->iProp->iType; |
|
1303 } |
|
1304 // |
|
1305 return ret; |
|
1306 } |
|
1307 |
|
1308 |
|
1309 TUint DMemSpyDriverOSAdaptionDPropertyRef::GetCategory( DObject& aObject ) const |
|
1310 { |
|
1311 TUint ret = 0; |
|
1312 // |
|
1313 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1314 if ( prop ) |
|
1315 { |
|
1316 ret = prop->iProp->iCategory; |
|
1317 } |
|
1318 // |
|
1319 return ret; |
|
1320 } |
|
1321 |
|
1322 |
|
1323 TUint DMemSpyDriverOSAdaptionDPropertyRef::GetKey( DObject& aObject ) const |
|
1324 { |
|
1325 TUint ret = 0; |
|
1326 // |
|
1327 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1328 if ( prop ) |
|
1329 { |
|
1330 ret = prop->iProp->iKey; |
|
1331 } |
|
1332 // |
|
1333 return ret; |
|
1334 } |
|
1335 |
|
1336 |
|
1337 TInt DMemSpyDriverOSAdaptionDPropertyRef::GetRefCount( DObject& aObject ) const |
|
1338 { |
|
1339 TInt ret = 0; |
|
1340 // |
|
1341 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1342 if ( prop ) |
|
1343 { |
|
1344 ret = prop->iProp->iRefCount; |
|
1345 } |
|
1346 // |
|
1347 return ret; |
|
1348 } |
|
1349 |
|
1350 |
|
1351 TUint DMemSpyDriverOSAdaptionDPropertyRef::GetThreadId( DObject& aObject ) const |
|
1352 { |
|
1353 TUint ret = 0; |
|
1354 // |
|
1355 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1356 if ( prop ) |
|
1357 { |
|
1358 DThread* thread = prop->iClient; |
|
1359 if ( thread ) |
|
1360 { |
|
1361 ret = OSAdaption().DThread().GetId( *thread ); |
|
1362 } |
|
1363 } |
|
1364 // |
|
1365 return ret; |
|
1366 } |
|
1367 |
|
1368 |
|
1369 TUint32 DMemSpyDriverOSAdaptionDPropertyRef::GetCreatorSID( DObject& aObject ) const |
|
1370 { |
|
1371 TUint32 ret = 0; |
|
1372 // |
|
1373 DMemSpyPropertyRef* prop = GetPropertyRef( aObject ); |
|
1374 if ( prop ) |
|
1375 { |
|
1376 ret = prop->iProp->iOwner; |
|
1377 } |
|
1378 // |
|
1379 return ret; |
|
1380 } |
|
1381 |
|
1382 |
|
1383 DMemSpyPropertyRef* DMemSpyDriverOSAdaptionDPropertyRef::GetPropertyRef( DObject& aObject ) const |
|
1384 { |
|
1385 DMemSpyPropertyRef* ret = NULL; |
|
1386 // |
|
1387 const TUint8 containerId = GetContainerID( aObject ) - 1; |
|
1388 if ( containerId == EPropertyRef ) |
|
1389 { |
|
1390 DMemSpyPropertyRef* prop = reinterpret_cast< DMemSpyPropertyRef* >( &aObject ); |
|
1391 if ( prop->iProp && prop->iClient ) |
|
1392 { |
|
1393 ret = prop; |
|
1394 } |
|
1395 } |
|
1396 // |
|
1397 return ret; |
|
1398 } |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 DMemSpyDriverOSAdaption::DMemSpyDriverOSAdaption( DMemSpyDriverDevice& aDevice ) |
|
1415 : iDevice( aDevice ) |
|
1416 { |
|
1417 } |
|
1418 |
|
1419 |
|
1420 DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() |
|
1421 { |
|
1422 TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() - START")); |
|
1423 NKern::ThreadEnterCS(); |
|
1424 // |
|
1425 delete iDThread; |
|
1426 delete iDProcess; |
|
1427 delete iDChunk; |
|
1428 delete iDServer; |
|
1429 delete iDSession; |
|
1430 delete iDCodeSeg; |
|
1431 delete iDSemaphore; |
|
1432 delete iDMutex; |
|
1433 delete iDLogicalDevice; |
|
1434 delete iDPhysicalDevice; |
|
1435 delete iDChangeNotifier; |
|
1436 delete iDUndertaker; |
|
1437 delete iDCondVar; |
|
1438 delete iDTimer; |
|
1439 delete iDPropertyRef; |
|
1440 // |
|
1441 NKern::ThreadLeaveCS(); |
|
1442 TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::~DMemSpyDriverOSAdaption() - END")); |
|
1443 } |
|
1444 |
|
1445 |
|
1446 TInt DMemSpyDriverOSAdaption::Construct() |
|
1447 { |
|
1448 TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::Construct() - START" ) ); |
|
1449 // |
|
1450 NKern::ThreadEnterCS(); |
|
1451 // |
|
1452 TInt error = KErrNoMemory; |
|
1453 // |
|
1454 iDThread = new DMemSpyDriverOSAdaptionDThread( *this ); |
|
1455 if ( iDThread ) |
|
1456 { |
|
1457 iDProcess = new DMemSpyDriverOSAdaptionDProcess( *this ); |
|
1458 if ( iDProcess ) |
|
1459 { |
|
1460 iDChunk = new DMemSpyDriverOSAdaptionDChunk( *this ); |
|
1461 if ( iDChunk ) |
|
1462 { |
|
1463 iDServer = new DMemSpyDriverOSAdaptionDServer( *this ); |
|
1464 if ( iDServer ) |
|
1465 { |
|
1466 iDSession = new DMemSpyDriverOSAdaptionDSession( *this ); |
|
1467 if ( iDSession ) |
|
1468 { |
|
1469 iDCodeSeg = new DMemSpyDriverOSAdaptionDCodeSeg( *this ); |
|
1470 if ( iDCodeSeg ) |
|
1471 { |
|
1472 iDSemaphore = new DMemSpyDriverOSAdaptionDSemaphore( *this ); |
|
1473 if ( iDSemaphore ) |
|
1474 { |
|
1475 iDMutex = new DMemSpyDriverOSAdaptionDMutex( *this ); |
|
1476 if ( iDMutex ) |
|
1477 { |
|
1478 iDLogicalDevice = new DMemSpyDriverOSAdaptionDLogicalDevice( *this ); |
|
1479 if ( iDLogicalDevice ) |
|
1480 { |
|
1481 iDPhysicalDevice = new DMemSpyDriverOSAdaptionDPhysicalDevice( *this ); |
|
1482 if ( iDPhysicalDevice ) |
|
1483 { |
|
1484 iDChangeNotifier = new DMemSpyDriverOSAdaptionDChangeNotifier( *this ); |
|
1485 if ( iDChangeNotifier ) |
|
1486 { |
|
1487 iDUndertaker = new DMemSpyDriverOSAdaptionDUndertaker( *this ); |
|
1488 if ( iDUndertaker ) |
|
1489 { |
|
1490 iDCondVar = new DMemSpyDriverOSAdaptionDCondVar( *this ); |
|
1491 if ( iDCondVar ) |
|
1492 { |
|
1493 iDTimer = new DMemSpyDriverOSAdaptionDTimer( *this ); |
|
1494 if ( iDTimer ) |
|
1495 { |
|
1496 iDPropertyRef = new DMemSpyDriverOSAdaptionDPropertyRef( *this ); |
|
1497 if ( iDPropertyRef ) |
|
1498 { |
|
1499 error = KErrNone; |
|
1500 } |
|
1501 } |
|
1502 } |
|
1503 } |
|
1504 } |
|
1505 } |
|
1506 } |
|
1507 } |
|
1508 } |
|
1509 } |
|
1510 } |
|
1511 } |
|
1512 } |
|
1513 } |
|
1514 } |
|
1515 // |
|
1516 NKern::ThreadLeaveCS(); |
|
1517 |
|
1518 TRACE( Kern::Printf( "DMemSpyDriverOSAdaption::Construct() - END - error: %d", error ) ); |
|
1519 return error; |
|
1520 } |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |