Update contrib.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Definitions for the run mode debug tests
27 #include "t_rmdebug_app.h"
28 #include "r_user_low_memory_security_svr_session.h"
29 #include "r_kernel_low_memory_security_svr_session.h"
34 // Create a pointer to function type
35 typedef void (CRunModeAgent::*testFunction)();
40 testFunction iFunctionPtr;
41 TBuf<40> iFunctionName;
44 //number of test functions that we have
45 const TInt KMaxTests = 28;
48 // class CRunModeAgent
50 // The basic run mode agent.
52 class CRunModeAgent : public CBase
55 static CRunModeAgent* NewL();
62 void SetupAndAttachToDSS();
67 void TestGetExecutablesList();
68 void TestGetProcessList();
69 void TestGetThreadList();
70 void TestGetCodeSegsList();
71 void TestGetXipLibrariesList();
72 void TestGetListInvalidData();
74 void DoTestGetThreadList(const TBool aShouldPass, const Debug::TListScope aListScope, const TUint64 aTargetId=0);
75 void DoTestGetCodeSegsList(const TBool aShouldPass, const Debug::TListScope aListScope, const TUint64 aTargetId=0);
77 void DoGetList(const Debug::TListId aListId, const Debug::TListScope aListScope, RBuf8& aBuffer, TUint32& aSize, const TUint64 aTargetId=0);
79 void TestMemoryAccess();
80 void TestSuspendResume();
81 void TestBreakPoints();
82 void TestConsecutiveBreakPoints();
83 void TestModifyBreak();
84 void DoTestModifyBreak(TBool aThreadSpecific);
86 void DoTestBreakInfo(TBool aThreadSpecific);
87 void TestRunToBreak();
88 void DoTestRunToBreak(TBool aThreadSpecific);
89 void TestRegisterAccess();
90 void TestAttachExecutable();
91 void TestDebugFunctionality();
93 void DoTestStep(TBool aThreadSpecific);
94 void TestDriverSecurity();
97 void TestEventsForExternalProcess();
98 void TestDemandPaging();
99 void TestTraceSecurity();
101 void TestKillProcess();
102 void TestProcessBreakPoints();
103 void TestMultipleTraceEvents();
104 void TestAddRemoveProcessEvents();
105 void TestProcessKillBreakpoint();
106 void DoTestProcessKillBreakpoint();
108 //crash flash test functions
109 void TestCrashFlash();
111 TInt GetFlag(const TDes8 &aFlags, const TUint aOffset, Debug::TRegisterFlag &aFlagValue) const;
113 void ReportPerformance(void);
116 void HelpTestSecurityAttachDetachExecutable(const TDesC& aProcessName, TBool aExpectSuccess);
118 TInt HelpTestStepSetBreak(Debug::TBreakId& aBreakId, TThreadId aThreadId, const TUint32 aBreakAddress, Debug::TArchitectureMode aMode, TBool aThreadSpecific=ETrue, TProcessId aProcessId=0);
119 TInt HelpTestStepClearBreak(const Debug::TBreakId aBreakId, const TThreadId aThreadId, TBool aThreadSpecific);
120 TInt HelpTestStepWaitForBreak(const TDesC& aProcessName, Debug::TEventInfo& aEventInfo);
121 TInt HelpTestStepReadPC(TThreadId aThreadId, TUint32& aPC);
122 TInt HelpTestStep(TThreadId aThreadId, TUint32 aStartAddress, TUint32 aEndAddress, Debug::TArchitectureMode aMode, TUint aNumSteps, TBool aThreadSpecific=ETrue, TProcessId=0);
124 TInt HelpTicksPerSecond(void);
127 void HelpStartTestTimer(void) { iStartTick = User::NTickCount(); iStopTick = 0; };
128 void HelpStopTestTimer(void) { iStopTick = User::NTickCount(); };
129 TInt HelpGetTestTicks(void) { return (iStopTick - iStartTick); };
130 TInt SwitchTestFunction(TTestFunction aTestFunction);
131 TInt LaunchProcess(RProcess& aProcess, const TDesC& aFileName, TDebugFunctionType aFunctionType, TUint32 aDelay=0, TUint32 aExtraThreads=0);
132 Debug::TTagHeader* GetTagHdr(const TDesC8& aDebugFunctionalityBlock, const Debug::TTagHeaderId aTagHdrId) const;
133 Debug::TTag* GetTag(const Debug::TTagHeader* aTagHdr, const TInt aElement) const;
134 Debug::TTag GetTag(const Debug::TTagHeaderId aTagHdrId, const TInt aElement);
135 TBool ProcessExists(const TProcessId aProcessId);
136 TBool ThreadExistsForProcess(const TThreadId aThreadId, const TProcessId aProcessId);
137 TBool ListingSupported(const Debug::TListId aListId, const Debug::TListScope aListScope);
138 void TestEventsWithExtraThreads(Debug::TKernelEventAction aActionMain, Debug::TKernelEventAction aActionExtra, TUint32 aExtraThreads);
147 //run the specified tests in reverse order
155 void RunTest(TInt aTestNumber);
156 void ParseCommandLineL(TUint32& aMode, RArray<TInt>& aTests);
158 TBool ProcessExists(const TDesC& aProcessName);
162 TFunctionData iTestArray[KMaxTests];
163 #if defined(KERNEL_OOM_TESTING)
164 RKernelLowMemorySecuritySvrSession iServSession;
165 #elif defined (USER_OOM_TESTING)
166 RUserLowMemorySecuritySvrSession iServSession;
168 Debug::RSecuritySvrSession iServSession;
170 RThread iDebugThread;
171 RProcess iDSSProcess;
172 RSemaphore iAddressGlobSem;
178 TInt iMemoryReadKbytesPerSecond;
179 TInt iMemoryWriteKbytesPerSecond;
180 TInt iBreakpointsPerSecond;
181 TInt iMaxBreakpoints;
182 TInt iStepsPerSecond;
184 // Timing information