First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\loader\t_ldrtst.h
18 #ifndef __T_LDRTST_H__
19 #define __T_LDRTST_H__
21 #define __INCLUDE_DEPENDENCY_GRAPH
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)); }
50 TUint8 iBitMap[(KNumModules+7)/8];
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);
64 SDllInfo iInfo[KNumModules];
70 static LoaderTest* New();
75 void TestMultipleExeInstances();
77 void TestMultipleLoads();
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);
102 const TInt KMaxHandlesPerDll=4;
103 const TInt KMaxHandles=KMaxHandlesPerDll*KNumModules;
105 struct SModuleInstance
109 TLinAddr iEntryPointAddress;
110 TModuleHandle iModuleHandle;
115 class CGlobalModuleList;
116 class CPerProcessInfo : public CBase
119 static CPerProcessInfo* New(TInt aExeNum, CGlobalModuleList& aG);
120 virtual ~CPerProcessInfo();
121 void GetModuleSet(TModuleSet& aSet);
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);
132 TRequestStatus iStatus;
134 RLoaderTest iSession;
136 CGlobalModuleList* iGlobalList;
137 TInt iModuleNum[KMaxHandles];
138 TInt iHandleCount[KNumModules];
139 SModuleInstance* iModules[KNumModules];
142 class CGlobalModuleList : public CBase
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);
152 TInt Load(TInt aExeNum, TInt aDllNum);
153 TInt CloseHandle(TInt aExeNum, TInt aDllNum);
163 TUint32 iMemModelAtt;
164 CPerProcessInfo* iPPInfo[KNumModules];
165 RPointerArray<SModuleInstance> iModules;
166 SModuleInstance* iModuleAlloc;
167 SModuleInstance* iFreeModules;
170 void GetNonZFileName(const TDesC& aOrigName, TDes& aNonZName);