sl@0
|
1 |
// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32\memmodel\epoc\multiple\mmonitor.cpp
|
sl@0
|
15 |
// Kernel crash debugger - machine independent portion
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <kernel/monitor.h>
|
sl@0
|
20 |
#include "memmodel.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
void Monitor::DumpMemModelProcessData(DProcess* aProcess)
|
sl@0
|
23 |
{
|
sl@0
|
24 |
DMemModelProcess* pP=(DMemModelProcess*)aProcess;
|
sl@0
|
25 |
Printf("OS ASID=%d, LPD=%08x, GPD=%08x\r\n",pP->iOsAsid,pP->iLocalPageDir,pP->iGlobalPageDir);
|
sl@0
|
26 |
Printf("ChunkCount=%d ChunkAlloc=%d\r\n",pP->iChunkCount,pP->iChunkAlloc);
|
sl@0
|
27 |
TInt i;
|
sl@0
|
28 |
for (i=0; i<pP->iChunkCount; i++)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
DMemModelProcess::SChunkInfo& ci=pP->iChunks[i];
|
sl@0
|
31 |
Printf("%d: Chunk %08x, access count %d\r\n",i,ci.iChunk,ci.iAccessCount);
|
sl@0
|
32 |
}
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
void Monitor::DumpChunkData(DChunk* aChunk)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
DMemModelChunk* pC=(DMemModelChunk*)aChunk;
|
sl@0
|
38 |
Printf("Owning Process %08x OS ASIDS %08x\r\n",pC->iOwningProcess,pC->iOsAsids);
|
sl@0
|
39 |
Printf("Size %x, MaxSize %x, Base %08x\r\n",pC->iSize,pC->iMaxSize,pC->iBase);
|
sl@0
|
40 |
Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos);
|
sl@0
|
41 |
Printf("Type %d\r\n",pC->iChunkType);
|
sl@0
|
42 |
Printf("PTE: %08x, PDE: %08x\r\n", pC->iPtePermissions,pC->iPdePermissions);
|
sl@0
|
43 |
Printf("PageTables=%08x, PageBitMap=%08x, PermPgBitMap=%08x\r\n",pC->iPageTables,pC->iPageBitMap,pC->iPermanentPageBitMap);
|
sl@0
|
44 |
DumpCpuChunkData(pC);
|
sl@0
|
45 |
if (pC->iKernelMirror)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
Printf("iKernelMirror=%08x\r\n", pC->iKernelMirror);
|
sl@0
|
48 |
DumpObjectData((DMonObject*)pC->iKernelMirror, EChunk);
|
sl@0
|
49 |
}
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
void Monitor::MMProcessInfoCommand()
|
sl@0
|
53 |
{
|
sl@0
|
54 |
TScheduler* pS=TScheduler::Ptr();
|
sl@0
|
55 |
#ifdef __SMP__
|
sl@0
|
56 |
TInt i;
|
sl@0
|
57 |
for (i=0; i<KMaxCpus; ++i)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
DMonObject* pA = (DMonObject*)pS->iSub[i]->iAddressSpace;
|
sl@0
|
60 |
Printf("CPU%d: TheCurrentAddressSpace=%08x\r\n",i,pA);
|
sl@0
|
61 |
}
|
sl@0
|
62 |
#else
|
sl@0
|
63 |
DMonObject* pA=(DMonObject*)pS->iAddressSpace;
|
sl@0
|
64 |
Printf("TheCurrentAddressSpace=%08x\r\n",pA);
|
sl@0
|
65 |
#endif
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg;
|
sl@0
|
71 |
DMemModelCodeSegMemory* mem = seg->Memory();
|
sl@0
|
72 |
Printf(" iPageCount: %x\r\n",mem ? mem->iPageCount : 0);
|
sl@0
|
73 |
Printf(" iPages: %08x (%08x)\r\n",mem ? mem->iPages : 0, mem ? *mem->iPages : 0);
|
sl@0
|
74 |
Printf(" iCodeAllocBase: %08x\r\n",seg->iCodeAllocBase);
|
sl@0
|
75 |
Printf(" iDataAllocBase: %08x\r\n",seg->iDataAllocBase);
|
sl@0
|
76 |
Printf(" iKernelData: %08x\r\n",seg->iKernelData);
|
sl@0
|
77 |
Printf(" iOsAsids: %08x\r\n",mem ? mem->iOsAsids : 0);
|
sl@0
|
78 |
Printf(" iCreator: %08x\r\n",mem ? mem->iCreator : 0);
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
extern TInt MapProcess(DMemModelProcess* aProcess, TBool aForce);
|
sl@0
|
82 |
|
sl@0
|
83 |
EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess;
|
sl@0
|
86 |
TInt r = SwitchAddressSpace(pP, EFalse);
|
sl@0
|
87 |
if (r!=KErrNone)
|
sl@0
|
88 |
return 0;
|
sl@0
|
89 |
return aThread->iUserStackRunAddress;
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess* aProcess, TBool aForce)
|
sl@0
|
93 |
{
|
sl@0
|
94 |
return MapProcess((DMemModelProcess*)aProcess, aForce);
|
sl@0
|
95 |
}
|