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 |
// Kernel crash debugger - machine independent portion
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
#define INCLUDED_FROM_ASM // Make DMemModelProcess::iOsAsid public, safe to
|
sl@0
|
18 |
// do here as the system has crashed and the inline
|
sl@0
|
19 |
// DMemModelProcess::OsAsid() requires too much kernel knowlodge.
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <kernel/monitor.h>
|
sl@0
|
22 |
#include <memmodel.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
void Monitor::DumpMemModelProcessData(DProcess* aProcess)
|
sl@0
|
25 |
{
|
sl@0
|
26 |
DMemModelProcess* pP=(DMemModelProcess*)aProcess;
|
sl@0
|
27 |
// Read the os asid without opening a reference as after the crash this
|
sl@0
|
28 |
// is the only running thread.
|
sl@0
|
29 |
Printf("OS ASID=%d, LPD=%08x\r\n",pP->iOsAsid,pP->iPageDir);
|
sl@0
|
30 |
Printf("ChunkCount=%d ChunkAlloc=%d\r\n",pP->iChunkCount,pP->iChunkAlloc);
|
sl@0
|
31 |
TInt i;
|
sl@0
|
32 |
for (i=0; i<pP->iChunkCount; i++)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
DMemModelProcess::SChunkInfo& ci=pP->iChunks[i];
|
sl@0
|
35 |
Printf("%d: Chunk %08x, access count %d\r\n",i,ci.iChunk,ci.iAccessCount);
|
sl@0
|
36 |
}
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
void Monitor::DumpChunkData(DChunk* aChunk)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
DMemModelChunk* pC=(DMemModelChunk*)aChunk;
|
sl@0
|
42 |
Printf("Owning Process %08x OS ASIDS %08x\r\n",pC->iOwningProcess);
|
sl@0
|
43 |
Printf("Size %x, MaxSize %x\r\n",pC->iSize,pC->iMaxSize);
|
sl@0
|
44 |
Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos);
|
sl@0
|
45 |
Printf("Type %d\r\n",pC->iChunkType);
|
sl@0
|
46 |
Printf("PageBitMap=%08x\r\n",pC->iPageBitMap);
|
sl@0
|
47 |
DumpCpuChunkData(pC);
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
void Monitor::MMProcessInfoCommand()
|
sl@0
|
51 |
{
|
sl@0
|
52 |
TScheduler* pS=TScheduler::Ptr();
|
sl@0
|
53 |
#ifdef __SMP__
|
sl@0
|
54 |
TInt i;
|
sl@0
|
55 |
for (i=0; i<KMaxCpus; ++i)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
DMonObject* pA = (DMonObject*)pS->iSub[i]->iAddressSpace;
|
sl@0
|
58 |
Printf("CPU%d: TheCurrentAddressSpace=%08x\r\n",i,pA);
|
sl@0
|
59 |
}
|
sl@0
|
60 |
#else
|
sl@0
|
61 |
DMonObject* pA=(DMonObject*)pS->iAddressSpace;
|
sl@0
|
62 |
Printf("TheCurrentAddressSpace=%08x\r\n",pA);
|
sl@0
|
63 |
#endif
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg;
|
sl@0
|
69 |
DMemModelCodeSegMemory* mem = seg->Memory();
|
sl@0
|
70 |
Printf(" iKernelData: %08x\r\n",seg->iKernelData);
|
sl@0
|
71 |
Printf(" iCreator: %08x\r\n",mem ? mem->iCreator : 0);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
extern TInt MapProcess(DMemModelProcess* aProcess, TBool aForce);
|
sl@0
|
75 |
|
sl@0
|
76 |
EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess;
|
sl@0
|
79 |
TInt r = SwitchAddressSpace(pP, EFalse);
|
sl@0
|
80 |
if (r!=KErrNone)
|
sl@0
|
81 |
return 0;
|
sl@0
|
82 |
return aThread->iUserStackRunAddress;
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess* aProcess, TBool aForce)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
return MapProcess((DMemModelProcess*)aProcess, aForce);
|
sl@0
|
88 |
}
|