sl@0: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Kernel crash debugger - machine independent portion sl@0: // sl@0: // sl@0: #define INCLUDED_FROM_ASM // Make DMemModelProcess::iOsAsid public, safe to sl@0: // do here as the system has crashed and the inline sl@0: // DMemModelProcess::OsAsid() requires too much kernel knowlodge. sl@0: sl@0: #include sl@0: #include sl@0: sl@0: void Monitor::DumpMemModelProcessData(DProcess* aProcess) sl@0: { sl@0: DMemModelProcess* pP=(DMemModelProcess*)aProcess; sl@0: // Read the os asid without opening a reference as after the crash this sl@0: // is the only running thread. sl@0: Printf("OS ASID=%d, LPD=%08x\r\n",pP->iOsAsid,pP->iPageDir); sl@0: Printf("ChunkCount=%d ChunkAlloc=%d\r\n",pP->iChunkCount,pP->iChunkAlloc); sl@0: TInt i; sl@0: for (i=0; iiChunkCount; i++) sl@0: { sl@0: DMemModelProcess::SChunkInfo& ci=pP->iChunks[i]; sl@0: Printf("%d: Chunk %08x, access count %d\r\n",i,ci.iChunk,ci.iAccessCount); sl@0: } sl@0: } sl@0: sl@0: void Monitor::DumpChunkData(DChunk* aChunk) sl@0: { sl@0: DMemModelChunk* pC=(DMemModelChunk*)aChunk; sl@0: Printf("Owning Process %08x OS ASIDS %08x\r\n",pC->iOwningProcess); sl@0: Printf("Size %x, MaxSize %x\r\n",pC->iSize,pC->iMaxSize); sl@0: Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos); sl@0: Printf("Type %d\r\n",pC->iChunkType); sl@0: Printf("PageBitMap=%08x\r\n",pC->iPageBitMap); sl@0: DumpCpuChunkData(pC); sl@0: } sl@0: sl@0: void Monitor::MMProcessInfoCommand() sl@0: { sl@0: TScheduler* pS=TScheduler::Ptr(); sl@0: #ifdef __SMP__ sl@0: TInt i; sl@0: for (i=0; iiSub[i]->iAddressSpace; sl@0: Printf("CPU%d: TheCurrentAddressSpace=%08x\r\n",i,pA); sl@0: } sl@0: #else sl@0: DMonObject* pA=(DMonObject*)pS->iAddressSpace; sl@0: Printf("TheCurrentAddressSpace=%08x\r\n",pA); sl@0: #endif sl@0: } sl@0: sl@0: void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg) sl@0: { sl@0: DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg; sl@0: DMemModelCodeSegMemory* mem = seg->Memory(); sl@0: Printf(" iKernelData: %08x\r\n",seg->iKernelData); sl@0: Printf(" iCreator: %08x\r\n",mem ? mem->iCreator : 0); sl@0: } sl@0: sl@0: extern TInt MapProcess(DMemModelProcess* aProcess, TBool aForce); sl@0: sl@0: EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread) sl@0: { sl@0: DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess; sl@0: TInt r = SwitchAddressSpace(pP, EFalse); sl@0: if (r!=KErrNone) sl@0: return 0; sl@0: return aThread->iUserStackRunAddress; sl@0: } sl@0: sl@0: EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess* aProcess, TBool aForce) sl@0: { sl@0: return MapProcess((DMemModelProcess*)aProcess, aForce); sl@0: }