sl@0: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\memmodel\epoc\moving\mmonitor.cpp sl@0: // Kernel crash debugger - machine independent portion sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include "memmodel.h" sl@0: sl@0: void Monitor::DumpMemModelProcessData(DProcess* aProcess) sl@0: { sl@0: DMemModelProcess* pP=(DMemModelProcess*)aProcess; sl@0: Printf("NumChunks=%d\r\n",pP->iNumChunks); sl@0: TInt i; sl@0: for (i=0; iiNumChunks; i++) sl@0: { sl@0: DMemModelProcess::SChunkInfo& ci=pP->iChunks[i]; sl@0: Printf("%d: Chunk %08x, run %08x, access count %d\r\n",i,ci.iChunk,ci.iDataSectionBase,ci.iAccessCount); sl@0: } sl@0: } sl@0: sl@0: void Monitor::DumpChunkData(DChunk* aChunk) sl@0: { sl@0: DMemModelChunk* pC=(DMemModelChunk*)aChunk; sl@0: Printf("Owning Process %08x\r\n",pC->iOwningProcess); sl@0: Printf("Size %x, MaxSize %x, Base %08x\r\n",pC->iSize,pC->iMaxSize,pC->iBase); sl@0: Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos); sl@0: Printf("Type %d, State %d, Home Base %08x\r\n",pC->iChunkType,pC->iChunkState,pC->iHomeBase); sl@0: Printf("Home Region Offset %08x\r\n",pC->iHomeRegionOffset); sl@0: Printf("Home Region Base %08x\r\n",pC->iHomeRegionBase); sl@0: Printf("Home Region Size %08x\r\n",pC->iHomeRegionSize); sl@0: Printf("PTE: %08x, PDE: %08x %08x %08x\r\n", pC->iPtePermissions, sl@0: pC->iPdePermissions[0],pC->iPdePermissions[1],pC->iPdePermissions[2]); sl@0: Printf("NumPdes=%d, iPdes=%08x, iHomePdes=%08x\r\n",pC->iNumPdes,pC->iPdes,pC->iHomePdes); sl@0: Printf("PdeBitMap=%08x, PageBitMap=%08x\r\n", sl@0: pC->iPdeBitMap, pC->iPageBitMap); sl@0: DumpCpuChunkData(pC); sl@0: } sl@0: sl@0: void Monitor::MMProcessInfoCommand() sl@0: { sl@0: TScheduler* pS=TScheduler::Ptr(); sl@0: DMonObject* pA=(DMonObject*)pS->iAddressSpace; sl@0: DMonObject* pV=(DMonObject*)pS->iExtras[0]; sl@0: DMonObject* pD=(DMonObject*)pS->iExtras[1]; sl@0: DMonObject* pC=(DMonObject*)pS->iExtras[2]; sl@0: Printf("TheCurrentAddressSpace=%08x\r\n",pA); sl@0: Printf("TheCurrentVMProcess=%08x\r\n",pV); sl@0: Monitor::DumpObjectData(pV,EProcess); sl@0: Printf("TheCurrentDataSectionProcess=%08x\r\n",pD); sl@0: Printf("TheCompleteDataSectionProcess=%08x\r\n",pC); sl@0: Monitor::DumpObjectData(pC,EProcess); sl@0: } sl@0: sl@0: void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg) sl@0: { sl@0: DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg; sl@0: Printf(" iCodeAllocBase: %08x\r\n",seg->iCodeAllocBase); sl@0: Printf(" iDataAllocBase: %08x\r\n",seg->iDataAllocBase); sl@0: Printf(" iKernelData: %08x\r\n",seg->iKernelData); sl@0: } sl@0: sl@0: EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread) sl@0: { sl@0: TLinAddr stackBase=aThread->iUserStackRunAddress; sl@0: TLinAddr stackTop=stackBase+aThread->iUserStackSize; sl@0: DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess; sl@0: if (!pP || ((DMonObject*)pP)->Type()!=EProcess) sl@0: return 0; sl@0: for(TInt i=0 ; iiNumChunks ; ++i) sl@0: { sl@0: DMemModelProcess::SChunkInfo& info=pP->iChunks[i]; sl@0: DMemModelChunk* pC=info.iChunk; sl@0: if (!pC || ((DMonObject*)pC)->Type()!=EChunk) sl@0: continue; sl@0: if (stackBase >= info.iDataSectionBase && sl@0: stackTop <= info.iDataSectionBase+pC->MaxSize()) sl@0: return (TUint)pC->iBase+(stackBase-info.iDataSectionBase); sl@0: } sl@0: return 0; sl@0: } sl@0: sl@0: EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess*, TBool) sl@0: { sl@0: return KErrNone; sl@0: }