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