Update contrib.
1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\memmodel\epoc\moving\mmonitor.cpp
15 // Kernel crash debugger - machine independent portion
19 #include <kernel/monitor.h>
22 void Monitor::DumpMemModelProcessData(DProcess* aProcess)
24 DMemModelProcess* pP=(DMemModelProcess*)aProcess;
25 Printf("NumChunks=%d\r\n",pP->iNumChunks);
27 for (i=0; i<pP->iNumChunks; i++)
29 DMemModelProcess::SChunkInfo& ci=pP->iChunks[i];
30 Printf("%d: Chunk %08x, run %08x, access count %d\r\n",i,ci.iChunk,ci.iDataSectionBase,ci.iAccessCount);
34 void Monitor::DumpChunkData(DChunk* aChunk)
36 DMemModelChunk* pC=(DMemModelChunk*)aChunk;
37 Printf("Owning Process %08x\r\n",pC->iOwningProcess);
38 Printf("Size %x, MaxSize %x, Base %08x\r\n",pC->iSize,pC->iMaxSize,pC->iBase);
39 Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos);
40 Printf("Type %d, State %d, Home Base %08x\r\n",pC->iChunkType,pC->iChunkState,pC->iHomeBase);
41 Printf("Home Region Offset %08x\r\n",pC->iHomeRegionOffset);
42 Printf("Home Region Base %08x\r\n",pC->iHomeRegionBase);
43 Printf("Home Region Size %08x\r\n",pC->iHomeRegionSize);
44 Printf("PTE: %08x, PDE: %08x %08x %08x\r\n", pC->iPtePermissions,
45 pC->iPdePermissions[0],pC->iPdePermissions[1],pC->iPdePermissions[2]);
46 Printf("NumPdes=%d, iPdes=%08x, iHomePdes=%08x\r\n",pC->iNumPdes,pC->iPdes,pC->iHomePdes);
47 Printf("PdeBitMap=%08x, PageBitMap=%08x\r\n",
48 pC->iPdeBitMap, pC->iPageBitMap);
52 void Monitor::MMProcessInfoCommand()
54 TScheduler* pS=TScheduler::Ptr();
55 DMonObject* pA=(DMonObject*)pS->iAddressSpace;
56 DMonObject* pV=(DMonObject*)pS->iExtras[0];
57 DMonObject* pD=(DMonObject*)pS->iExtras[1];
58 DMonObject* pC=(DMonObject*)pS->iExtras[2];
59 Printf("TheCurrentAddressSpace=%08x\r\n",pA);
60 Printf("TheCurrentVMProcess=%08x\r\n",pV);
61 Monitor::DumpObjectData(pV,EProcess);
62 Printf("TheCurrentDataSectionProcess=%08x\r\n",pD);
63 Printf("TheCompleteDataSectionProcess=%08x\r\n",pC);
64 Monitor::DumpObjectData(pC,EProcess);
67 void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg)
69 DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg;
70 Printf(" iCodeAllocBase: %08x\r\n",seg->iCodeAllocBase);
71 Printf(" iDataAllocBase: %08x\r\n",seg->iDataAllocBase);
72 Printf(" iKernelData: %08x\r\n",seg->iKernelData);
75 EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread)
77 TLinAddr stackBase=aThread->iUserStackRunAddress;
78 TLinAddr stackTop=stackBase+aThread->iUserStackSize;
79 DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess;
80 if (!pP || ((DMonObject*)pP)->Type()!=EProcess)
82 for(TInt i=0 ; i<pP->iNumChunks ; ++i)
84 DMemModelProcess::SChunkInfo& info=pP->iChunks[i];
85 DMemModelChunk* pC=info.iChunk;
86 if (!pC || ((DMonObject*)pC)->Type()!=EChunk)
88 if (stackBase >= info.iDataSectionBase &&
89 stackTop <= info.iDataSectionBase+pC->MaxSize())
90 return (TUint)pC->iBase+(stackBase-info.iDataSectionBase);
95 EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess*, TBool)