sl@0: // Copyright (c) 2005-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: // e32test/debug/d_debugapi.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __D_DEBUGAPI_H__ sl@0: #define __D_DEBUGAPI_H__ sl@0: sl@0: #ifdef __KERNEL_MODE__ sl@0: #include sl@0: #else sl@0: #include sl@0: #endif sl@0: sl@0: _LIT(KTestLddName, "TestDebugAPI"); sl@0: sl@0: class RDebugAPIChecker: public RBusLogicalChannel sl@0: { sl@0: public: sl@0: enum sl@0: { sl@0: ETProcess, sl@0: ETChunk, sl@0: ETThread, sl@0: ETIPAccess sl@0: }; sl@0: /**Used to pass arguments to ldd when checking inter-process data access*/ sl@0: struct IPAccessArgs sl@0: { sl@0: TUint iProcessID; sl@0: TUint iAddress; sl@0: TUint iValue; sl@0: }; sl@0: sl@0: public: sl@0: static inline TVersion Version() { return TVersion(1, 0, 1); } sl@0: #ifndef __KERNEL_MODE__ sl@0: public: sl@0: inline TInt Open(); sl@0: inline TInt Process(); sl@0: inline TInt Chunk(); sl@0: inline TInt Thread(); sl@0: inline TInt IPAccess(RDebugAPIChecker::IPAccessArgs* aArgs); sl@0: #endif sl@0: }; sl@0: sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: sl@0: inline TInt RDebugAPIChecker::Open() sl@0: { sl@0: return DoCreate(KTestLddName, Version(), NULL, NULL, NULL, EOwnerThread); sl@0: } sl@0: inline TInt RDebugAPIChecker::Process() sl@0: { sl@0: return DoControl(ETProcess); sl@0: } sl@0: inline TInt RDebugAPIChecker::Chunk() sl@0: { sl@0: return DoControl(ETChunk); sl@0: } sl@0: inline TInt RDebugAPIChecker::Thread() sl@0: { sl@0: return DoControl(ETThread); sl@0: } sl@0: inline TInt RDebugAPIChecker::IPAccess(RDebugAPIChecker::IPAccessArgs* aArgs) sl@0: { sl@0: return DoControl(ETIPAccess, aArgs); sl@0: } sl@0: sl@0: #endif //#ifndef __KERNEL_MODE__ sl@0: sl@0: #ifdef __KERNEL_MODE__ sl@0: sl@0: /** sl@0: Holds the offsets common to all memory models. sl@0: @see TOffsetTableEntry. sl@0: */ sl@0: struct TDebugOffsetTable sl@0: { sl@0: // debugger info sl@0: TInt iDebugger_ObjectOffsetTable; sl@0: TInt iDebugger_ObjectOffsetTableCount; sl@0: TInt iDebugger_ThreadContextTable; sl@0: TInt iDebugger_Version; sl@0: TInt iDebugger_OSVersion; sl@0: TInt iDebugger_Reserved; sl@0: TInt iDebugger_Containers; sl@0: TInt iDebugger_Scheduler; sl@0: TInt iDebugger_CurrentThread; sl@0: TInt iDebugger_CodeSegGlobalList; sl@0: TInt iDebugger_CodeSegLock; sl@0: TInt iDebugger_Change; sl@0: // DMutex info sl@0: TInt iMutex_HoldCount; sl@0: // more debugger info sl@0: TInt iDebugger_ShadowPages; sl@0: TInt iDebugger_ShadowPageCount; sl@0: TInt iDebugger_EventMask; sl@0: // DObjectCon info sl@0: TInt iObjectCon_Mutex; sl@0: TInt iObjectCon_Objects; sl@0: TInt iObjectCon_Count; sl@0: // more debugger info sl@0: TInt iDebugger_EventHandlerBreakpoint; sl@0: TInt iDebuggerOffset_Reserved6; sl@0: TInt iDebuggerOffset_Reserved7; sl@0: TInt iDebuggerOffset_Reserved8; sl@0: // thread info sl@0: TInt iThread_Name; sl@0: TInt iThread_Id; sl@0: TInt iThread_OwningProcess; sl@0: TInt iThread_NThread; sl@0: TInt iThread_SupervisorStack; sl@0: TInt iThread_SupervisorStackSize; sl@0: TInt iThread_UserStackRunAddress; sl@0: TInt iThread_UserStackSize; sl@0: TInt iThread_UserContextType; sl@0: TInt iThread_SavedSupervisorSP; sl@0: TInt iThread_Priority; sl@0: TInt iThread_ThreadType; sl@0: TInt iDebuggerOffset_Reserved12; sl@0: // process info sl@0: TInt iProcess_Name; sl@0: TInt iProcess_Id; sl@0: TInt iProcess_Attributes; sl@0: TInt iProcess_CodeSeg; sl@0: TInt iProcess_DataBssRunAddress; sl@0: TInt iProcess_DataBssStackChunk; sl@0: TInt iProcess_ChunkCount; //ARMv5 specific sl@0: TInt iProcess_Chunks; //ARMv5 specific sl@0: TInt iDebuggerOffset_Reserved13; sl@0: TInt iDebuggerOffset_Reserved14; sl@0: TInt iDebuggerOffset_Reserved15; sl@0: TInt iDebuggerOffset_Reserved16; sl@0: // chunkinfo info sl@0: TInt iChunkInfo_DataSectionBase; //ARMv5 specific sl@0: TInt iChunkInfo_Chunk; //ARMv5 specific sl@0: TInt iDebuggerOffset_Reserved36; sl@0: TInt iDebuggerOffset_Reserved37; sl@0: // chunk info sl@0: TInt iChunk_OwningProcess; //ARMv5 specific sl@0: TInt iChunk_Size; sl@0: TInt iChunk_Attributes; sl@0: TInt iChunk_ChunkType; sl@0: TInt iChunk_ChunkState; //ARMv5 specific sl@0: TInt iChunk_HomeBase; //ARMv5 specific sl@0: TInt iDebuggerOffset_Reserved17; sl@0: TInt iDebuggerOffset_Reserved18; sl@0: TInt iDebuggerOffset_Reserved19; sl@0: TInt iDebuggerOffset_Reserved20; sl@0: // library info sl@0: TInt iLibrary_MapCount; sl@0: TInt iLibrary_State; sl@0: TInt iLibrary_CodeSeg; sl@0: TInt iDebuggerOffset_Reserved21; sl@0: TInt iDebuggerOffset_Reserved22; sl@0: TInt iDebuggerOffset_Reserved23; sl@0: TInt iDebuggerOffset_Reserved24; sl@0: // code seg info sl@0: TInt iCodeSeg_Next; sl@0: TInt iCodeSeg_Prev; sl@0: TInt iCodeSeg_Deps; sl@0: TInt iCodeSeg_DepsCount; sl@0: TInt iCodeSeg_FileName; sl@0: TInt iCodeSeg_XIP; sl@0: TInt iCodeSeg_Info; sl@0: TInt iDebuggerOffset_Reserved25; sl@0: TInt iDebuggerOffset_Reserved26; sl@0: TInt iDebuggerOffset_Reserved27; sl@0: TInt iDebuggerOffset_Reserved28; sl@0: // scheduler info sl@0: TInt iScheduler_KernCSLocked; sl@0: TInt iScheduler_LockWaiting; sl@0: TInt iScheduler_CurrentThread; sl@0: TInt iScheduler_AddressSpace; sl@0: TInt iDebuggerOffset_Reserved29; sl@0: TInt iDebuggerOffset_Reserved30; sl@0: TInt iDebuggerOffset_Reserved31; sl@0: TInt iDebuggerOffset_Reserved32; sl@0: // code segment information non-XIP sl@0: TInt iCodeSegInfoRAM_CodeSize; sl@0: TInt iCodeSegInfoRAM_TextSize; sl@0: TInt iCodeSegInfoRAM_DataSize; sl@0: TInt iCodeSegInfoRAM_BssSize; sl@0: TInt iCodeSegInfoRAM_CodeRunAddress; sl@0: TInt iCodeSegInfoRAM_CodeLoadAddress; sl@0: TInt iCodeSegInfoRAM_DataRunAddr; sl@0: TInt iCodeSegInfoRAM_DataLoadAddr; sl@0: TInt iCodeSegInfoRAM_ConstOffset; sl@0: TInt iCodeSegInfoRAM_ExportDir; sl@0: TInt iCodeSegInfoRAM_ExportDirCount; sl@0: TInt iDebuggerOffset_Reserved38; sl@0: TInt iDebuggerOffset_Reserved39; sl@0: TInt iDebuggerOffset_Reserved40; sl@0: TInt iDebuggerOffset_Reserved41; sl@0: // code segment information XIP sl@0: TInt iCodeSegInfoXIP_CodeAddress; sl@0: TInt iCodeSegInfoXIP_DataAddress; sl@0: TInt iCodeSegInfoXIP_DataRunAddress; sl@0: TInt iCodeSegInfoXIP_CodeSize; sl@0: TInt iCodeSegInfoXIP_TextSize; sl@0: TInt iCodeSegInfoXIP_DataSize; sl@0: TInt iCodeSegInfoXIP_BssSize; sl@0: TInt iCodeSegInfoXIP_ExportDir; sl@0: TInt iCodeSegInfoXIP_ExportDirCount; sl@0: TInt iDebuggerOffset_Reserved42; sl@0: TInt iDebuggerOffset_Reserved43; sl@0: TInt iDebuggerOffset_Reserved44; sl@0: TInt iDebuggerOffset_Reserved45; sl@0: }; sl@0: sl@0: /** sl@0: Holds the offsets specific to moving memory models. sl@0: @see TOffsetMovingTableEntry sl@0: */ sl@0: struct TMovingDebugOffsetTable sl@0: { sl@0: TInt iProcess_ChunkCount; sl@0: TInt iProcess_Chunks; sl@0: sl@0: TInt iChunkInfo_DataSectionBase; sl@0: TInt iChunkInfo_Chunk; sl@0: sl@0: TInt iChunk_OwningProcess; sl@0: TInt iChunk_ChunkState; sl@0: TInt iChunk_HomeBase; sl@0: sl@0: TInt iReserved1; sl@0: TInt iReserved2; sl@0: TInt iReserved3; sl@0: TInt iReserved4; sl@0: }; sl@0: sl@0: /** sl@0: Holds the offsets specific to multiple memory models. sl@0: @see TOffsetMultipleTableEntry sl@0: */ sl@0: struct TMultipleDebugOffsetTable sl@0: { sl@0: TInt iProcess_OsAsid; sl@0: TInt iProcess_LocalPageDir; sl@0: TInt iProcess_ChunkCount; sl@0: TInt iProcess_Chunks; sl@0: TInt iChunkInfo_Chunk; sl@0: TInt iChunk_OwningProcess; sl@0: TInt iReserved1; sl@0: TInt iReserved2; sl@0: TInt iReserved3; sl@0: TInt iReserved4; sl@0: }; sl@0: sl@0: class DDebugAPIChecker : public DLogicalChannelBase sl@0: { sl@0: public: sl@0: virtual ~DDebugAPIChecker(); sl@0: protected: sl@0: // from DLogicalChannelBase sl@0: virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer); sl@0: virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2); sl@0: private: sl@0: inline TInt8 Read8(void* aBase, TInt aOffset) {return *((TInt8*)aBase + aOffset);} sl@0: inline TInt Read(void* aBase, TInt aOffset) {return (TInt) (*((TInt*)((TInt8*)aBase + aOffset)));} sl@0: sl@0: TInt Process(); sl@0: TInt Chunk(); sl@0: TInt Thread(); sl@0: TInt IPAccess(TAny* a1); sl@0: TUint8* ExtractName(TInt aSymbianName, TUint8* aCharName); sl@0: TInt GetOffsets(); sl@0: sl@0: TInt ReadFromOtherProcessArmv6(); sl@0: sl@0: private: sl@0: DDebuggerInfo* iDebugInfo; sl@0: TDebugOffsetTable* iOffsetTable;/**Contains the offsets common to all memory models*/ sl@0: TMemoryModelType iMMUType; /**Identifies the memory model*/ sl@0: void* iVariantOffsetTable; /**Contains memory-model-spacific offsets*/ sl@0: TInt* iScheduler; /**Will hold the address of the scheduler*/ sl@0: sl@0: TInt iCurrentProcess_OsAsid; //Used to call ReadFromOtherProcessArmv6 sl@0: TInt iCurrentProcess_LocalPageDir; //Used to call ReadFromOtherProcessArmv6 sl@0: TInt iOtherProcess_OsAsid; //Used to call ReadFromOtherProcessArmv6 sl@0: TInt iOtherProcess_LocalPageDir; //Used to call ReadFromOtherProcessArmv6 sl@0: TInt iAddress; //Used to call ReadFromOtherProcessArmv6 sl@0: }; sl@0: sl@0: #endif //#ifdef __KERNEL_MODE__ sl@0: sl@0: #endif // __D_DEBUGAPI_H__