44
|
1 |
// Copyright (c) 2006-2010 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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Definitions for the run mode debug tests
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalTechnology
|
|
21 |
@released
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef RMDEBUG_H
|
|
25 |
#define RMDEBUG_H
|
|
26 |
|
|
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"
|
|
30 |
|
|
31 |
|
|
32 |
class CRunModeAgent;
|
|
33 |
|
|
34 |
// Create a pointer to function type
|
|
35 |
typedef void (CRunModeAgent::*testFunction)();
|
|
36 |
|
|
37 |
class TFunctionData
|
|
38 |
{
|
|
39 |
public:
|
|
40 |
testFunction iFunctionPtr;
|
|
41 |
TBuf<40> iFunctionName;
|
|
42 |
};
|
|
43 |
|
|
44 |
//number of test functions that we have
|
|
45 |
const TInt KMaxTests = 29;
|
|
46 |
|
|
47 |
//
|
|
48 |
// class CRunModeAgent
|
|
49 |
//
|
|
50 |
// The basic run mode agent.
|
|
51 |
//
|
|
52 |
class CRunModeAgent : public CBase
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
static CRunModeAgent* NewL();
|
|
56 |
~CRunModeAgent();
|
|
57 |
void ClientAppL();
|
|
58 |
|
|
59 |
private:
|
|
60 |
CRunModeAgent();
|
|
61 |
void ConstructL();
|
|
62 |
void SetupAndAttachToDSS();
|
|
63 |
|
|
64 |
TInt TestStartup();
|
|
65 |
TInt TestShutdown();
|
|
66 |
|
|
67 |
void TestGetExecutablesList();
|
|
68 |
void TestGetProcessList();
|
|
69 |
void TestGetThreadList();
|
|
70 |
void TestGetCodeSegsList();
|
|
71 |
void TestGetXipLibrariesList();
|
|
72 |
void TestGetListInvalidData();
|
|
73 |
|
|
74 |
TBool 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);
|
|
76 |
|
|
77 |
void DoGetList(const Debug::TListId aListId, const Debug::TListScope aListScope, RBuf8& aBuffer, TUint32& aSize, const TUint64 aTargetId=0);
|
|
78 |
|
|
79 |
void TestMemoryAccess();
|
|
80 |
void TestSuspendResume();
|
|
81 |
void TestBreakPoints();
|
|
82 |
void TestConsecutiveBreakPoints();
|
|
83 |
void TestModifyBreak();
|
|
84 |
void DoTestModifyBreak(TBool aThreadSpecific);
|
|
85 |
void TestBreakInfo();
|
|
86 |
void DoTestBreakInfo(TBool aThreadSpecific);
|
|
87 |
void TestRunToBreak();
|
|
88 |
void DoTestRunToBreak(TBool aThreadSpecific);
|
|
89 |
void TestBreakPointsInLoop();
|
|
90 |
void DoTestBreakPointsInLoop(TBool aThreadSpecific);
|
|
91 |
void TestRegisterAccess();
|
|
92 |
void TestAttachExecutable();
|
|
93 |
void TestDebugFunctionality();
|
|
94 |
void TestStep();
|
|
95 |
void DoTestStep(TBool aThreadSpecific);
|
|
96 |
void TestDriverSecurity();
|
|
97 |
void TestSecurity();
|
|
98 |
void TestEvents();
|
|
99 |
void TestEventsForExternalProcess();
|
|
100 |
void TestDemandPaging();
|
|
101 |
void TestTraceSecurity();
|
|
102 |
void TestDllUsage();
|
|
103 |
void TestKillProcess();
|
|
104 |
void TestProcessBreakPoints();
|
|
105 |
void TestMultipleTraceEvents();
|
|
106 |
void TestAddRemoveProcessEvents();
|
|
107 |
void TestProcessKillBreakpoint();
|
|
108 |
void DoTestProcessKillBreakpoint();
|
|
109 |
|
|
110 |
//crash flash test functions
|
|
111 |
void TestCrashFlash();
|
|
112 |
|
|
113 |
TInt GetFlag(const TDes8 &aFlags, const TUint aOffset, Debug::TRegisterFlag &aFlagValue) const;
|
|
114 |
|
|
115 |
void ReportPerformance(void);
|
|
116 |
|
|
117 |
// helper functions
|
|
118 |
void HelpTestSecurityAttachDetachExecutable(const TDesC& aProcessName, TBool aExpectSuccess);
|
|
119 |
|
|
120 |
TInt HelpTestStepSetBreak(Debug::TBreakId& aBreakId, TThreadId aThreadId, const TUint32 aBreakAddress, Debug::TArchitectureMode aMode, TBool aThreadSpecific=ETrue, TProcessId aProcessId=0);
|
|
121 |
TInt HelpTestStepClearBreak(const Debug::TBreakId aBreakId, const TThreadId aThreadId, TBool aThreadSpecific);
|
|
122 |
TInt HelpTestStepWaitForBreak(const TDesC& aProcessName, Debug::TEventInfo& aEventInfo);
|
|
123 |
TInt HelpTestStepReadPC(TThreadId aThreadId, TUint32& aPC);
|
|
124 |
TInt HelpTestStep(TThreadId aThreadId, TUint32 aStartAddress, TUint32 aEndAddress, Debug::TArchitectureMode aMode, TUint aNumSteps, TBool aThreadSpecific=ETrue, TProcessId=0);
|
|
125 |
|
|
126 |
TInt HelpTicksPerSecond(void);
|
|
127 |
|
|
128 |
// helper functions
|
|
129 |
void HelpStartTestTimer(void) { iStartTick = User::NTickCount(); iStopTick = 0; };
|
|
130 |
void HelpStopTestTimer(void) { iStopTick = User::NTickCount(); };
|
|
131 |
TInt HelpGetTestTicks(void) { return (iStopTick - iStartTick); };
|
|
132 |
TInt SwitchTestFunction(TTestFunction aTestFunction);
|
|
133 |
TInt LaunchProcess(RProcess& aProcess, const TDesC& aFileName, TDebugFunctionType aFunctionType, TUint32 aDelay=0, TUint32 aExtraThreads=0);
|
|
134 |
Debug::TTagHeader* GetTagHdr(const TDesC8& aDebugFunctionalityBlock, const Debug::TTagHeaderId aTagHdrId) const;
|
|
135 |
Debug::TTag* GetTag(const Debug::TTagHeader* aTagHdr, const TInt aElement) const;
|
|
136 |
Debug::TTag GetTag(const Debug::TTagHeaderId aTagHdrId, const TInt aElement);
|
|
137 |
TBool ProcessExists(const TProcessId aProcessId);
|
|
138 |
TBool ThreadExistsForProcess(const TThreadId aThreadId, const TProcessId aProcessId);
|
|
139 |
TBool ListingSupported(const Debug::TListId aListId, const Debug::TListScope aListScope);
|
|
140 |
void TestEventsWithExtraThreads(Debug::TKernelEventAction aActionMain, Debug::TKernelEventAction aActionExtra, TUint32 aExtraThreads);
|
|
141 |
void FillArray();
|
|
142 |
void PrintUsage();
|
|
143 |
void PrintVersion();
|
|
144 |
|
|
145 |
enum TTestMode
|
|
146 |
{
|
|
147 |
//run all the tests
|
|
148 |
EModeAll = 1<<0,
|
|
149 |
//run the specified tests in reverse order
|
|
150 |
EModeReverse = 1<<1,
|
|
151 |
//print out help
|
|
152 |
EModeHelp = 1<<2,
|
|
153 |
//print out help
|
|
154 |
EModeVersion = 1<<3
|
|
155 |
};
|
|
156 |
|
|
157 |
void RunTest(TInt aTestNumber);
|
|
158 |
void ParseCommandLineL(TUint32& aMode, RArray<TInt>& aTests);
|
|
159 |
|
|
160 |
TBool ProcessExists(const TDesC& aProcessName);
|
|
161 |
|
|
162 |
private:
|
|
163 |
|
|
164 |
TFunctionData iTestArray[KMaxTests];
|
|
165 |
#if defined(KERNEL_OOM_TESTING)
|
|
166 |
RKernelLowMemorySecuritySvrSession iServSession;
|
|
167 |
#elif defined (USER_OOM_TESTING)
|
|
168 |
RUserLowMemorySecuritySvrSession iServSession;
|
|
169 |
#else
|
|
170 |
Debug::RSecuritySvrSession iServSession;
|
|
171 |
#endif
|
|
172 |
RThread iDebugThread;
|
|
173 |
RProcess iDSSProcess;
|
|
174 |
RSemaphore iAddressGlobSem;
|
|
175 |
TThreadId iThreadID;
|
|
176 |
TFileName iFileName;
|
|
177 |
TUid iMySid;
|
|
178 |
|
|
179 |
// Performance data
|
|
180 |
TInt iMemoryReadKbytesPerSecond;
|
|
181 |
TInt iMemoryWriteKbytesPerSecond;
|
|
182 |
TInt iBreakpointsPerSecond;
|
|
183 |
TInt iMaxBreakpoints;
|
|
184 |
TInt iStepsPerSecond;
|
|
185 |
|
|
186 |
// Timing information
|
|
187 |
TInt iStartTick;
|
|
188 |
TInt iStopTick;
|
|
189 |
};
|
|
190 |
|
|
191 |
#endif // RMDEBUG_H
|