os/kernelhwsrv/kerneltest/e32test/rm_debug/t_rmdebug2.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/rm_debug/t_rmdebug2.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,189 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Definitions for the run mode debug tests
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalTechnology
    1.24 + @released
    1.25 +*/
    1.26 +
    1.27 +#ifndef RMDEBUG_H
    1.28 +#define RMDEBUG_H
    1.29 +
    1.30 +#include "t_rmdebug_app.h"
    1.31 +#include "r_user_low_memory_security_svr_session.h"
    1.32 +#include "r_kernel_low_memory_security_svr_session.h"
    1.33 +
    1.34 +
    1.35 +class CRunModeAgent;
    1.36 +
    1.37 +// Create a pointer to function type
    1.38 +typedef void (CRunModeAgent::*testFunction)();
    1.39 +
    1.40 +class TFunctionData
    1.41 +	{
    1.42 +public:
    1.43 +	testFunction iFunctionPtr;
    1.44 +	TBuf<40> iFunctionName;
    1.45 +	};
    1.46 +
    1.47 +//number of test functions that we have
    1.48 +const TInt KMaxTests = 28;
    1.49 +
    1.50 +//
    1.51 +// class CRunModeAgent
    1.52 +//
    1.53 +// The basic run mode agent.
    1.54 +//
    1.55 +class CRunModeAgent : public CBase
    1.56 +	{
    1.57 +public:
    1.58 +	static CRunModeAgent* NewL();
    1.59 +	~CRunModeAgent();
    1.60 +	void ClientAppL();
    1.61 +
    1.62 +private:
    1.63 +	CRunModeAgent();
    1.64 +	void ConstructL();
    1.65 +	void SetupAndAttachToDSS();
    1.66 +
    1.67 +	TInt TestStartup();
    1.68 +	TInt TestShutdown();
    1.69 +
    1.70 +	void TestGetExecutablesList();
    1.71 +	void TestGetProcessList();
    1.72 +	void TestGetThreadList();
    1.73 +	void TestGetCodeSegsList();
    1.74 +	void TestGetXipLibrariesList();
    1.75 +	void TestGetListInvalidData();
    1.76 +
    1.77 +	void DoTestGetThreadList(const TBool aShouldPass, const Debug::TListScope aListScope, const TUint64 aTargetId=0);
    1.78 +	void DoTestGetCodeSegsList(const TBool aShouldPass, const Debug::TListScope aListScope, const TUint64 aTargetId=0);
    1.79 +
    1.80 +	void DoGetList(const Debug::TListId aListId, const Debug::TListScope aListScope, RBuf8& aBuffer, TUint32& aSize, const TUint64 aTargetId=0);
    1.81 +
    1.82 +	void TestMemoryAccess();
    1.83 +	void TestSuspendResume();
    1.84 +	void TestBreakPoints();
    1.85 +	void TestConsecutiveBreakPoints();
    1.86 +	void TestModifyBreak();
    1.87 +	void DoTestModifyBreak(TBool aThreadSpecific);
    1.88 +	void TestBreakInfo();
    1.89 +	void DoTestBreakInfo(TBool aThreadSpecific);
    1.90 +	void TestRunToBreak();
    1.91 +	void DoTestRunToBreak(TBool aThreadSpecific);
    1.92 +	void TestRegisterAccess();
    1.93 +	void TestAttachExecutable();
    1.94 +	void TestDebugFunctionality();
    1.95 +	void TestStep();
    1.96 +	void DoTestStep(TBool aThreadSpecific);
    1.97 +	void TestDriverSecurity();
    1.98 +	void TestSecurity();
    1.99 +	void TestEvents();
   1.100 +	void TestEventsForExternalProcess();
   1.101 +	void TestDemandPaging();
   1.102 +	void TestTraceSecurity();
   1.103 +	void TestDllUsage();
   1.104 +	void TestKillProcess();
   1.105 +	void TestProcessBreakPoints();
   1.106 +	void TestMultipleTraceEvents();
   1.107 +	void TestAddRemoveProcessEvents();
   1.108 +	void TestProcessKillBreakpoint();
   1.109 +	void DoTestProcessKillBreakpoint();
   1.110 +
   1.111 +	//crash flash test functions
   1.112 +	void TestCrashFlash();
   1.113 +		
   1.114 +	TInt GetFlag(const TDes8 &aFlags, const TUint aOffset, Debug::TRegisterFlag &aFlagValue) const;
   1.115 +
   1.116 +	void ReportPerformance(void);
   1.117 +
   1.118 +	// helper functions
   1.119 +	void HelpTestSecurityAttachDetachExecutable(const TDesC& aProcessName, TBool aExpectSuccess);
   1.120 +
   1.121 +	TInt HelpTestStepSetBreak(Debug::TBreakId& aBreakId, TThreadId aThreadId, const TUint32 aBreakAddress, Debug::TArchitectureMode aMode, TBool aThreadSpecific=ETrue, TProcessId aProcessId=0);
   1.122 +	TInt HelpTestStepClearBreak(const Debug::TBreakId aBreakId, const TThreadId aThreadId, TBool aThreadSpecific);
   1.123 +	TInt HelpTestStepWaitForBreak(const TDesC& aProcessName, Debug::TEventInfo& aEventInfo);
   1.124 +	TInt HelpTestStepReadPC(TThreadId aThreadId, TUint32& aPC);
   1.125 +	TInt HelpTestStep(TThreadId aThreadId, TUint32 aStartAddress, TUint32 aEndAddress, Debug::TArchitectureMode aMode, TUint aNumSteps, TBool aThreadSpecific=ETrue, TProcessId=0);
   1.126 +
   1.127 +	TInt HelpTicksPerSecond(void);
   1.128 +
   1.129 +	// helper functions
   1.130 +	void HelpStartTestTimer(void) { iStartTick = User::NTickCount(); iStopTick = 0; };
   1.131 +	void HelpStopTestTimer(void) { iStopTick = User::NTickCount(); };
   1.132 +	TInt HelpGetTestTicks(void) { return (iStopTick - iStartTick); };
   1.133 +	TInt SwitchTestFunction(TTestFunction aTestFunction);
   1.134 +	TInt LaunchProcess(RProcess& aProcess, const TDesC& aFileName, TDebugFunctionType aFunctionType, TUint32 aDelay=0, TUint32 aExtraThreads=0);
   1.135 +	Debug::TTagHeader* GetTagHdr(const TDesC8& aDebugFunctionalityBlock, const Debug::TTagHeaderId aTagHdrId) const;
   1.136 +	Debug::TTag* GetTag(const Debug::TTagHeader* aTagHdr, const TInt aElement) const;
   1.137 +	Debug::TTag GetTag(const Debug::TTagHeaderId aTagHdrId, const TInt aElement);
   1.138 +	TBool ProcessExists(const TProcessId aProcessId);
   1.139 +	TBool ThreadExistsForProcess(const TThreadId aThreadId, const TProcessId aProcessId);
   1.140 +	TBool ListingSupported(const Debug::TListId aListId, const Debug::TListScope aListScope);
   1.141 +	void TestEventsWithExtraThreads(Debug::TKernelEventAction aActionMain, Debug::TKernelEventAction aActionExtra, TUint32 aExtraThreads);
   1.142 +	void FillArray();
   1.143 +	void PrintUsage();
   1.144 +	void PrintVersion();
   1.145 +
   1.146 +	enum TTestMode 
   1.147 +		{
   1.148 +		//run all the tests
   1.149 +		EModeAll = 1<<0,
   1.150 +		//run the specified tests in reverse order
   1.151 +		EModeReverse = 1<<1,
   1.152 +		//print out help
   1.153 +		EModeHelp = 1<<2,
   1.154 +		//print out help
   1.155 +		EModeVersion = 1<<3
   1.156 +		};
   1.157 +
   1.158 +	void RunTest(TInt aTestNumber);
   1.159 +	void ParseCommandLineL(TUint32& aMode, RArray<TInt>& aTests);
   1.160 +
   1.161 +	TBool ProcessExists(const TDesC& aProcessName);
   1.162 +
   1.163 +private:
   1.164 +
   1.165 +	TFunctionData iTestArray[KMaxTests];
   1.166 +#if defined(KERNEL_OOM_TESTING)
   1.167 +	RKernelLowMemorySecuritySvrSession iServSession;
   1.168 +#elif defined (USER_OOM_TESTING)
   1.169 +	RUserLowMemorySecuritySvrSession iServSession;
   1.170 +#else
   1.171 +	Debug::RSecuritySvrSession iServSession;
   1.172 +#endif
   1.173 +	RThread	iDebugThread;
   1.174 +	RProcess iDSSProcess;
   1.175 +	RSemaphore iAddressGlobSem;
   1.176 +	TThreadId iThreadID;
   1.177 +	TFileName iFileName;
   1.178 +	TUid iMySid;
   1.179 +
   1.180 +	// Performance data
   1.181 +	TInt iMemoryReadKbytesPerSecond;	
   1.182 +	TInt iMemoryWriteKbytesPerSecond;	
   1.183 +	TInt iBreakpointsPerSecond;
   1.184 +	TInt iMaxBreakpoints;
   1.185 +	TInt iStepsPerSecond;
   1.186 +
   1.187 +	// Timing information
   1.188 +	TInt iStartTick;
   1.189 +	TInt iStopTick;
   1.190 +	};
   1.191 +
   1.192 +#endif // RMDEBUG_H