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