Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 extern NonXIP gNonXIP;
24 const char* COMMON_SECT="Common";
25 const char* PROFILE_SECT="Profile";
26 const char* PARTITION_SECT="Partition";
27 const char* FORMAT_SECT="Format";
28 const char* NON_XIP_SECT="NonXIP";
30 std::string Analyse::iRomFile;
31 std::string Analyse::iThread;
32 std::string Analyse::iDll;
33 std::string Analyse::iFunction;
34 std::vector<std::string> Analyse::iTraces;
36 int Analyse::ProcessCfgFile(const char* aCfgFileName)
40 if (aCfgFileName[0] != '\\' || aCfgFileName[1] != ':')
42 char ** file_name = 0;
43 if (!GetFullPathNameA(aCfgFileName, sizeof path, path, file_name))
48 if (GetFileAttributesA(aCfgFileName) == 0xffffffff) // no ini file
50 int rc = GetPrivateProfileStringA(COMMON_SECT, "TraceFile", "", buf, sizeof buf, aCfgFileName);
53 iTraces.push_back(buf);
54 sTraces.push_back(iTraces[iTraces.size()-1].c_str());
57 GetPrivateProfileStringA(COMMON_SECT, "Mode", "profile", buf, sizeof buf, aCfgFileName);
73 rc = GetPrivateProfileStringA(COMMON_SECT, "SymbolFile", "", buf, sizeof buf, aCfgFileName);
77 sRomFile = iRomFile.c_str();
80 rc = GetPrivateProfileStringA(COMMON_SECT, "Range", "", buf, sizeof buf, aCfgFileName);
85 char * p = strrchr(buf, '+');
89 p = strrchr(buf, '-');
90 if (!p) return EErrorCfgFile;
92 sBeginSample = atoi(buf);
93 sEndSample = atoi(++p);
95 sEndSample = sEndSample += sBeginSample;
98 rc = GetPrivateProfileIntA(COMMON_SECT, "IncludeNullThread", 0, aCfgFileName);
102 rc = GetPrivateProfileStringA(COMMON_SECT, "Cutoff", "", buf, sizeof buf, aCfgFileName);
107 rc = GetPrivateProfileStringA(PROFILE_SECT, "Thread", "", buf, sizeof buf, aCfgFileName);
111 sThread = iThread.c_str();
114 rc = GetPrivateProfileStringA(PROFILE_SECT, "Dll", "", buf, sizeof buf, aCfgFileName);
121 rc = GetPrivateProfileStringA(PROFILE_SECT, "Function", "", buf, sizeof buf, aCfgFileName);
125 sFunction = iFunction.c_str();
128 rc = GetPrivateProfileStringA(PROFILE_SECT, "Range", "", buf, sizeof buf, aCfgFileName);
131 sOptions |= EAddress;
133 char * p = strrchr(buf, '+');
137 p = strrchr(buf, '-');
138 if (!p) return EErrorCfgFile;
140 sBase = strtoul(buf,0,16);
141 sLim = strtoul(++p,0,16);
143 sLim = sLim += sBase;
147 rc = GetPrivateProfileStringA(PARTITION_SECT, "Mode", "", buf, sizeof buf, aCfgFileName);
156 sPartition = EFunction;
159 return EErrorCfgFile;
163 rc = GetPrivateProfileIntA(PARTITION_SECT, "BucketSize", 0, aCfgFileName);
170 rc = GetPrivateProfileIntA(PARTITION_SECT, "NumberOfBuckets", 0, aCfgFileName);
173 sPartition = EBuckets;
179 rc = GetPrivateProfileStringA(FORMAT_SECT, "Mode", "", buf, sizeof buf, aCfgFileName);
194 return EErrorCfgFile;
198 rc = GetPrivateProfileIntA(FORMAT_SECT, "ZeroValues", 0, aCfgFileName);
202 rc = GetPrivateProfileIntA(FORMAT_SECT, "NoOthers", 0, aCfgFileName);
204 sOptions |= ENoOther;
206 rc = GetPrivateProfileIntA(FORMAT_SECT, "TotalOnly", 0, aCfgFileName);
208 sOptions |= ETotalOnly;
212 for(int i=1;sprintf(key,"ObyFile%d",i),
213 GetPrivateProfileStringA(NON_XIP_SECT, key, "", buf, sizeof buf, aCfgFileName);i++)
214 gNonXIP.AddObyFile(buf);
216 for(i=1;sprintf(key,"RofsSymbolFile%d",i),
217 GetPrivateProfileStringA(NON_XIP_SECT, key, "", buf, sizeof buf, aCfgFileName);i++)
218 gNonXIP.AddSymbolFile(buf);