author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 27 Apr 2010 18:02:57 +0300 | |
branch | RCL_3 |
changeset 97 | 41f0cfe18c80 |
parent 33 | 0173bcd7697c |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1999-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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32test\loader\t_ldrtst.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef __T_LDRTST_H__ |
|
19 |
#define __T_LDRTST_H__ |
|
20 |
||
21 |
#define __INCLUDE_DEPENDENCY_GRAPH |
|
22 |
||
23 |
#include <e32svr.h> |
|
24 |
#include <e32test.h> |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#include <e32ver.h> |
0 | 26 |
#include "dlltree.h" |
27 |
#include "dllt.h" |
|
28 |
#include "exetifc.h" |
|
29 |
#include <d_ldrtst.h> |
|
30 |
#include <f32file.h> |
|
31 |
#include <f32dbg.h> |
|
32 |
#include <e32rom.h> |
|
33 |
||
34 |
GLREF_D RTest test; |
|
35 |
||
36 |
class TModuleList; |
|
37 |
class TModuleSet |
|
38 |
{ |
|
39 |
public: |
|
40 |
TModuleSet(); |
|
41 |
TModuleSet(const TModuleList&, TInt aMask, TInt aVal); |
|
42 |
void Add(TInt aModule); |
|
43 |
void Remove(TInt aModule); |
|
44 |
void Remove(const TModuleList&); |
|
45 |
void Display(const TDesC& aTitle) const; |
|
46 |
inline TBool Present(TInt aModule) const |
|
47 |
{ return iBitMap[aModule>>3]&(1<<(aModule&7)); } |
|
48 |
public: |
|
49 |
TInt iCount; |
|
50 |
TUint8 iBitMap[(KNumModules+7)/8]; |
|
51 |
}; |
|
52 |
||
53 |
class TModuleList |
|
54 |
{ |
|
55 |
public: |
|
56 |
TModuleList(); |
|
57 |
void SetCount(); |
|
58 |
void Display(const TDesC& aTitle) const; |
|
59 |
TBool IsPresent(TInt aModNum) const; |
|
60 |
TInt Find(TInt aModNum) const; |
|
61 |
void Add(const SDllInfo& a); |
|
62 |
public: |
|
63 |
TInt iCount; |
|
64 |
SDllInfo iInfo[KNumModules]; |
|
65 |
}; |
|
66 |
||
67 |
class LoaderTest |
|
68 |
{ |
|
69 |
public: |
|
70 |
static LoaderTest* New(); |
|
71 |
void Close(); |
|
72 |
void Init(); |
|
73 |
public: |
|
74 |
void TestOneByOne(); |
|
75 |
void TestMultipleExeInstances(); |
|
76 |
void TestOOM(); |
|
77 |
void TestMultipleLoads(); |
|
78 |
private: |
|
79 |
TBool IsRomAddress(TLinAddr a); |
|
80 |
TBool IsRamCodeAddress(TLinAddr a); |
|
81 |
TBool CheckDataAddress(TLinAddr a, TInt aDllNum, TInt aExeNum); |
|
82 |
TInt DetermineDllLoadResult(TInt aDllNum, TInt aExeNum); |
|
83 |
TInt DetermineDllLoadResult(TInt aDllNum, TInt aExeNum1, TInt aExeNum2); |
|
84 |
TInt DetermineLoadExe2Result(TInt aExeNum); |
|
85 |
void DumpModuleList(const TModuleList& aList, TInt aExeNum); |
|
86 |
void DumpModuleInfo(const SDllInfo& aInfo, TInt aExeNum); |
|
87 |
void CheckModuleList(TInt aRoot, const TModuleList& aList); |
|
88 |
public: |
|
89 |
void TraceOn(); |
|
90 |
void TraceOff(); |
|
91 |
private: |
|
92 |
LoaderTest(); |
|
93 |
~LoaderTest(); |
|
94 |
public: |
|
95 |
RFs iFs; |
|
96 |
RLdrTest iDev; |
|
97 |
TUint32 iMemModelAtt; |
|
98 |
TInt iCmdLine[8]; |
|
99 |
}; |
|
100 |
||
101 |
||
102 |
const TInt KMaxHandlesPerDll=4; |
|
103 |
const TInt KMaxHandles=KMaxHandlesPerDll*KNumModules; |
|
104 |
||
105 |
struct SModuleInstance |
|
106 |
{ |
|
107 |
TInt iAccessCount; |
|
108 |
TInt iModNum; |
|
109 |
TLinAddr iEntryPointAddress; |
|
110 |
TModuleHandle iModuleHandle; |
|
111 |
TLinAddr iData; |
|
112 |
TAny* iCodeSeg; |
|
113 |
}; |
|
114 |
||
115 |
class CGlobalModuleList; |
|
116 |
class CPerProcessInfo : public CBase |
|
117 |
{ |
|
118 |
public: |
|
119 |
static CPerProcessInfo* New(TInt aExeNum, CGlobalModuleList& aG); |
|
120 |
virtual ~CPerProcessInfo(); |
|
121 |
void GetModuleSet(TModuleSet& aSet); |
|
122 |
void Check(); |
|
123 |
void Unlink(const SDllInfo& a, TModuleList& aList); |
|
124 |
TInt Load(TInt aDllNum); |
|
125 |
TInt AddModules(TInt aDllNum, TModuleList* aCList, TModuleList* aIList); |
|
126 |
TInt CloseHandle(TInt aHandle); |
|
127 |
private: |
|
128 |
CPerProcessInfo(); |
|
129 |
TInt Init(); |
|
130 |
public: |
|
131 |
TInt iExeNum; |
|
132 |
TRequestStatus iStatus; |
|
133 |
RProcess iProcess; |
|
134 |
RLoaderTest iSession; |
|
135 |
RLdrTest iDev; |
|
136 |
CGlobalModuleList* iGlobalList; |
|
137 |
TInt iModuleNum[KMaxHandles]; |
|
138 |
TInt iHandleCount[KNumModules]; |
|
139 |
SModuleInstance* iModules[KNumModules]; |
|
140 |
}; |
|
141 |
||
142 |
class CGlobalModuleList : public CBase |
|
143 |
{ |
|
144 |
public: |
|
145 |
static CGlobalModuleList* New(const LoaderTest&); |
|
146 |
virtual ~CGlobalModuleList(); |
|
147 |
void Close(SModuleInstance* a); |
|
148 |
void Free(SModuleInstance* a); |
|
149 |
SModuleInstance* GetMI(); |
|
150 |
TAny* CodeSegFromHandle(TModuleHandle aModHandle); |
|
151 |
void CheckAll(); |
|
152 |
TInt Load(TInt aExeNum, TInt aDllNum); |
|
153 |
TInt CloseHandle(TInt aExeNum, TInt aDllNum); |
|
154 |
private: |
|
155 |
CGlobalModuleList(); |
|
156 |
void Init(); |
|
157 |
public: |
|
158 |
TInt iMaxModules; |
|
159 |
TInt iNumExes; |
|
160 |
TInt iFixedExes; |
|
161 |
TInt iParam; |
|
162 |
RLdrTest iDev; |
|
163 |
TUint32 iMemModelAtt; |
|
164 |
CPerProcessInfo* iPPInfo[KNumModules]; |
|
165 |
RPointerArray<SModuleInstance> iModules; |
|
166 |
SModuleInstance* iModuleAlloc; |
|
167 |
SModuleInstance* iFreeModules; |
|
168 |
}; |
|
169 |
||
170 |
void GetNonZFileName(const TDesC& aOrigName, TDes& aNonZName); |
|
171 |
||
172 |
#endif |