memspy/Engine/Source/Helpers/MemSpyEngineHelperActiveObject.cpp
changeset 30 86a2e675b80a
parent 0 a03f92240627
child 44 52e343bb8f80
equal deleted inserted replaced
26:4fde310f06fe 30:86a2e675b80a
    99     err = iEngine.Driver().GetHeapInfoUser( iHeapInfo, aThread.Id() );
    99     err = iEngine.Driver().GetHeapInfoUser( iHeapInfo, aThread.Id() );
   100     User::LeaveIfError( err );
   100     User::LeaveIfError( err );
   101     //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - allocated cell header length is: %d", iHeapInfo.iHeapCellHeaderLengthAllocated);
   101     //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - allocated cell header length is: %d", iHeapInfo.iHeapCellHeaderLengthAllocated);
   102 
   102 
   103     // Do we have a ROM-based scheduler pointer?
   103     // Do we have a ROM-based scheduler pointer?
   104     if  ( scheduler != NULL && iHeapInfo.Type() == TMemSpyHeapInfo::ETypeRHeap )
   104     if  ( scheduler != NULL && iHeapInfo.Type() != TMemSpyHeapInfo::ETypeUnknown )
   105         {
   105         {
   106         //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - scheduler: 0x%08x", scheduler);
   106         //RDebug::Printf("CMemSpyEngineHelperActiveObject::ActiveObjectListLC() - scheduler: 0x%08x", scheduler);
   107 
   107 
   108         // Let's try to get the scheduler's heap cell...
   108         // Let's try to get the scheduler's heap cell...
   109         HBufC8* data = SchedulerHeapCellDataLC( scheduler, aThread.Id() );
   109         HBufC8* data = SchedulerHeapCellDataLC( scheduler, aThread.Id() );
   147     //
   147     //
   148     err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
   148     err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
   149     //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
   149     //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
   150     User::LeaveIfError( err );
   150     User::LeaveIfError( err );
   151     
   151     
   152     if  ( cellType == EMemSpyDriverGoodAllocatedCell )
   152 	if (cellType & EMemSpyDriverAllocatedCellMask)
   153         {
   153         {
   154         const TInt payloadLength = cellLength - iHeapInfo.AsRHeap().MetaData().HeaderSizeAllocated();
   154         const TInt payloadLength = cellLength;
   155         HBufC8* data = HBufC8::NewLC( payloadLength );
   155         HBufC8* data = HBufC8::NewLC( payloadLength );
   156         TPtr8 pData( data->Des() );
   156         TPtr8 pData( data->Des() );
   157         //
   157         //
   158         err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, payloadLength );
   158         err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, payloadLength );
   159         //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - data fetch returned error: %d", err);
   159         //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - data fetch returned error: %d", err);
   279     TAny* requestedCellAddress = aCellAddress;
   279     TAny* requestedCellAddress = aCellAddress;
   280     TInt err = iEngine.Driver().WalkHeapGetCellInfo( requestedCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
   280     TInt err = iEngine.Driver().WalkHeapGetCellInfo( requestedCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
   281     //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
   281     //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
   282     User::LeaveIfError( err );
   282     User::LeaveIfError( err );
   283     
   283     
   284     if  ( cellType == EMemSpyDriverGoodAllocatedCell )
   284     if (cellType & EMemSpyDriverAllocatedCellMask)
   285         {
   285         {
   286         const TInt payloadLength = cellLength - iHeapInfo.AsRHeap().MetaData().HeaderSizeAllocated();
   286         const TInt payloadLength = cellLength;
   287         //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - payloadLength: %d", payloadLength);
   287         //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - payloadLength: %d", payloadLength);
   288 
   288 
   289         // const TInt payloadLength = Max( 512, cellLength - iHeapInfo.iHeapCellHeaderLengthAllocated ); // Prevent negative payload lengths?
   289         // const TInt payloadLength = Max( 512, cellLength - iHeapInfo.iHeapCellHeaderLengthAllocated ); // Prevent negative payload lengths?
   290         CBufFlat* data = CBufFlat::NewL( payloadLength );
   290         CBufFlat* data = CBufFlat::NewL( payloadLength );
   291         CleanupStack::PushL( data );
   291         CleanupStack::PushL( data );