|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\memmodel\epoc\multiple\mmonitor.cpp |
|
15 // Kernel crash debugger - machine independent portion |
|
16 // |
|
17 // |
|
18 |
|
19 #include <kernel/monitor.h> |
|
20 #include "memmodel.h" |
|
21 |
|
22 void Monitor::DumpMemModelProcessData(DProcess* aProcess) |
|
23 { |
|
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); |
|
27 TInt i; |
|
28 for (i=0; i<pP->iChunkCount; i++) |
|
29 { |
|
30 DMemModelProcess::SChunkInfo& ci=pP->iChunks[i]; |
|
31 Printf("%d: Chunk %08x, access count %d\r\n",i,ci.iChunk,ci.iAccessCount); |
|
32 } |
|
33 } |
|
34 |
|
35 void Monitor::DumpChunkData(DChunk* aChunk) |
|
36 { |
|
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); |
|
44 DumpCpuChunkData(pC); |
|
45 if (pC->iKernelMirror) |
|
46 { |
|
47 Printf("iKernelMirror=%08x\r\n", pC->iKernelMirror); |
|
48 DumpObjectData((DMonObject*)pC->iKernelMirror, EChunk); |
|
49 } |
|
50 } |
|
51 |
|
52 void Monitor::MMProcessInfoCommand() |
|
53 { |
|
54 TScheduler* pS=TScheduler::Ptr(); |
|
55 #ifdef __SMP__ |
|
56 TInt i; |
|
57 for (i=0; i<KMaxCpus; ++i) |
|
58 { |
|
59 DMonObject* pA = (DMonObject*)pS->iSub[i]->iAddressSpace; |
|
60 Printf("CPU%d: TheCurrentAddressSpace=%08x\r\n",i,pA); |
|
61 } |
|
62 #else |
|
63 DMonObject* pA=(DMonObject*)pS->iAddressSpace; |
|
64 Printf("TheCurrentAddressSpace=%08x\r\n",pA); |
|
65 #endif |
|
66 } |
|
67 |
|
68 void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg) |
|
69 { |
|
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); |
|
79 } |
|
80 |
|
81 extern TInt MapProcess(DMemModelProcess* aProcess, TBool aForce); |
|
82 |
|
83 EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread) |
|
84 { |
|
85 DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess; |
|
86 TInt r = SwitchAddressSpace(pP, EFalse); |
|
87 if (r!=KErrNone) |
|
88 return 0; |
|
89 return aThread->iUserStackRunAddress; |
|
90 } |
|
91 |
|
92 EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess* aProcess, TBool aForce) |
|
93 { |
|
94 return MapProcess((DMemModelProcess*)aProcess, aForce); |
|
95 } |