First public contribution.
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\multiple\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("OS ASID=%d, LPD=%08x, GPD=%08x\r\n",pP->iOsAsid,pP->iLocalPageDir,pP->iGlobalPageDir);
26 Printf("ChunkCount=%d ChunkAlloc=%d\r\n",pP->iChunkCount,pP->iChunkAlloc);
28 for (i=0; i<pP->iChunkCount; i++)
30 DMemModelProcess::SChunkInfo& ci=pP->iChunks[i];
31 Printf("%d: Chunk %08x, access count %d\r\n",i,ci.iChunk,ci.iAccessCount);
35 void Monitor::DumpChunkData(DChunk* aChunk)
37 DMemModelChunk* pC=(DMemModelChunk*)aChunk;
38 Printf("Owning Process %08x OS ASIDS %08x\r\n",pC->iOwningProcess,pC->iOsAsids);
39 Printf("Size %x, MaxSize %x, Base %08x\r\n",pC->iSize,pC->iMaxSize,pC->iBase);
40 Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos);
41 Printf("Type %d\r\n",pC->iChunkType);
42 Printf("PTE: %08x, PDE: %08x\r\n", pC->iPtePermissions,pC->iPdePermissions);
43 Printf("PageTables=%08x, PageBitMap=%08x, PermPgBitMap=%08x\r\n",pC->iPageTables,pC->iPageBitMap,pC->iPermanentPageBitMap);
45 if (pC->iKernelMirror)
47 Printf("iKernelMirror=%08x\r\n", pC->iKernelMirror);
48 DumpObjectData((DMonObject*)pC->iKernelMirror, EChunk);
52 void Monitor::MMProcessInfoCommand()
54 TScheduler* pS=TScheduler::Ptr();
57 for (i=0; i<KMaxCpus; ++i)
59 DMonObject* pA = (DMonObject*)pS->iSub[i]->iAddressSpace;
60 Printf("CPU%d: TheCurrentAddressSpace=%08x\r\n",i,pA);
63 DMonObject* pA=(DMonObject*)pS->iAddressSpace;
64 Printf("TheCurrentAddressSpace=%08x\r\n",pA);
68 void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg)
70 DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg;
71 DMemModelCodeSegMemory* mem = seg->Memory();
72 Printf(" iPageCount: %x\r\n",mem ? mem->iPageCount : 0);
73 Printf(" iPages: %08x (%08x)\r\n",mem ? mem->iPages : 0, mem ? *mem->iPages : 0);
74 Printf(" iCodeAllocBase: %08x\r\n",seg->iCodeAllocBase);
75 Printf(" iDataAllocBase: %08x\r\n",seg->iDataAllocBase);
76 Printf(" iKernelData: %08x\r\n",seg->iKernelData);
77 Printf(" iOsAsids: %08x\r\n",mem ? mem->iOsAsids : 0);
78 Printf(" iCreator: %08x\r\n",mem ? mem->iCreator : 0);
81 extern TInt MapProcess(DMemModelProcess* aProcess, TBool aForce);
83 EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread)
85 DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess;
86 TInt r = SwitchAddressSpace(pP, EFalse);
89 return aThread->iUserStackRunAddress;
92 EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess* aProcess, TBool aForce)
94 return MapProcess((DMemModelProcess*)aProcess, aForce);