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