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