20
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "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".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Class representing a module in project (sbs2)
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "../inc/CATModule2.h"
|
|
20 |
#include "../inc/CATProject.h"
|
|
21 |
#include "../inc/CATDatParser.h"
|
|
22 |
#include "../inc/CATMemoryAddress.h"
|
|
23 |
#include "../inc/catdbghelper.h"
|
|
24 |
#include "../inc/cataddr2line.h"
|
|
25 |
|
|
26 |
CATModule2::CATModule2(void)
|
|
27 |
{
|
|
28 |
LOG_FUNC_ENTRY("CATModule2::CATModule2");
|
|
29 |
m_bAddressToLineInitialized = false;
|
|
30 |
m_pAddressToLine = 0;
|
|
31 |
m_sErrors = "";
|
|
32 |
m_sMakeFile = "";
|
|
33 |
m_eBuildSystem = CATProject::SBS_V1;
|
|
34 |
m_sCompileInfoText = "";
|
|
35 |
}
|
|
36 |
|
|
37 |
CATModule2::~CATModule2(void)
|
|
38 |
{
|
|
39 |
LOG_FUNC_ENTRY("CATModule2::~CATModule2");
|
|
40 |
if ( m_pAddressToLine )
|
|
41 |
m_pAddressToLine->Close();
|
|
42 |
delete m_pAddressToLine;
|
|
43 |
}
|
|
44 |
|
|
45 |
bool CATModule2::AddressToLine( CATMemoryAddress* pMemoryAddress )
|
|
46 |
{
|
|
47 |
LOG_FUNC_ENTRY("CATModule2::AddressToLine");
|
|
48 |
if ( _stricmp( m_sVariantPlatform.c_str(), "winscw" ) == 0 )
|
|
49 |
{
|
|
50 |
return AddressToLineWinscw( pMemoryAddress );
|
|
51 |
}
|
|
52 |
else if ( _stricmp( m_sVariantPlatform.c_str(), "armv5" ) == 0 )
|
|
53 |
{
|
|
54 |
// addr2line exe.
|
|
55 |
#ifdef ADDR2LINE
|
|
56 |
return AddressToLineAddr2lineExe( pMemoryAddress );
|
|
57 |
#endif
|
|
58 |
// lst and map files.
|
|
59 |
#ifndef ADDR2LINE
|
|
60 |
return AddressToLineArmv5( pMemoryAddress );
|
|
61 |
#endif
|
|
62 |
}
|
|
63 |
else if ( _stricmp( m_sVariantPlatform.c_str(), "gcce" ) == 0 )
|
|
64 |
{
|
|
65 |
return AddressToLineAddr2lineExe( pMemoryAddress );
|
|
66 |
}
|
|
67 |
return false;
|
|
68 |
}
|
|
69 |
|
|
70 |
bool CATModule2::AddressToLineWinscw( CATMemoryAddress* pMemoryAddress )
|
|
71 |
{
|
|
72 |
LOG_FUNC_ENTRY("CATModule2::AddressToLineWinscw( CATMemoryAddress* pMemoryAddress )");
|
|
73 |
if ( m_pAddressToLine == 0 && ! m_bAddressToLineInitialized )
|
|
74 |
{
|
|
75 |
// Use debug helper to locate codelines on winscw platform.
|
|
76 |
m_pAddressToLine = new CATDbgHelper();
|
|
77 |
|
|
78 |
// Create full path to binary which we open using CATDbgHelper.
|
|
79 |
string sFullPathToBinary = GetBinaryFile();
|
|
80 |
|
|
81 |
// If opening of binary not succesfull set return value to false.
|
|
82 |
if ( ! m_pAddressToLine->Open( sFullPathToBinary, pMemoryAddress->GetModuleStartAddress() ) )
|
|
83 |
{
|
|
84 |
LOG_STRING("Error, m_pAddressToLine->Open()");
|
|
85 |
return false;
|
|
86 |
}
|
|
87 |
m_bAddressToLineInitialized = true;
|
|
88 |
}
|
|
89 |
// Check pointer before calling.
|
|
90 |
if ( m_pAddressToLine == 0 )
|
|
91 |
return false;
|
|
92 |
m_pAddressToLine->AddressToLine( pMemoryAddress );
|
|
93 |
return true;
|
|
94 |
}
|
|
95 |
|
|
96 |
bool CATModule2::AddressToLineArmv5( CATMemoryAddress* pMemoryAddress )
|
|
97 |
{
|
|
98 |
LOG_FUNC_ENTRY("CATModule2::AddressToLine( CATMemoryAddress* pMemoryAddress )");
|
|
99 |
if ( ! m_bAddressToLineInitialized )
|
|
100 |
return false;
|
|
101 |
// Find from map file
|
|
102 |
int iMapIndex = GetSymbolIndexUsingAddress( pMemoryAddress->GetOffSetFromModuleStart() );
|
|
103 |
if ( iMapIndex == -1 )
|
|
104 |
{
|
|
105 |
pMemoryAddress->SetAddressToLineState( CATMemoryAddress::OUT_OF_RANGE );
|
|
106 |
return true;
|
|
107 |
}
|
|
108 |
// Set symbol name
|
|
109 |
string sSymbolName = m_vMapFileFuncList.at( iMapIndex ).sFunctionName;
|
|
110 |
|
|
111 |
// Remove (... from symbol name
|
|
112 |
string sSymbolNameRefined( sSymbolName );
|
|
113 |
size_t iPos = sSymbolNameRefined.find( "(" );
|
|
114 |
if ( iPos != string::npos )
|
|
115 |
sSymbolNameRefined.resize( iPos );
|
|
116 |
|
|
117 |
// Set symbol name as function name for memory address
|
|
118 |
pMemoryAddress->SetFunctionName( sSymbolNameRefined );
|
|
119 |
|
|
120 |
// Set state to symbol
|
|
121 |
pMemoryAddress->SetAddressToLineState( CATMemoryAddress::SYMBOL );
|
|
122 |
|
|
123 |
// Offset from function start addr
|
|
124 |
int iOffSetFromFuncStart = pMemoryAddress->GetOffSetFromModuleStart()
|
|
125 |
- m_vMapFileFuncList.at( iMapIndex ).iAddress;
|
|
126 |
|
|
127 |
// Find from lst list
|
|
128 |
int iLstIndex = GetLineInFileIndexUsingSymbolName( sSymbolName );
|
|
129 |
if ( iLstIndex == -1 )
|
|
130 |
return true;
|
|
131 |
|
|
132 |
// Set pinpointing
|
|
133 |
int iFuncLineNumber = m_vLineInFile.at( iLstIndex ).iLine;
|
|
134 |
string sFileName = m_vLineInFile.at( iLstIndex ).sFileName;
|
|
135 |
string sLstFileName = m_vLineInFile.at( iLstIndex ).sLstName;
|
|
136 |
|
|
137 |
pMemoryAddress->SetFunctionLineNumber( iFuncLineNumber );
|
|
138 |
pMemoryAddress->SetFileName( sFileName );
|
|
139 |
|
|
140 |
pMemoryAddress->SetAddressToLineState( CATMemoryAddress::FUNCTION );
|
|
141 |
|
|
142 |
// In urel mode don't get exact code line
|
|
143 |
if ( ! IsUDEB() )
|
|
144 |
return true;
|
|
145 |
|
|
146 |
// Next calculate the code line inside function
|
|
147 |
int iExactLineNumber = FindLeakCodeLine( sLstFileName, iFuncLineNumber, iOffSetFromFuncStart );
|
|
148 |
pMemoryAddress->SetExactLineNumber( iExactLineNumber );
|
|
149 |
|
|
150 |
// State is now exact
|
|
151 |
pMemoryAddress->SetAddressToLineState( CATMemoryAddress::EXACT );
|
|
152 |
return true;
|
|
153 |
}
|
|
154 |
|
|
155 |
bool CATModule2::AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress )
|
|
156 |
{
|
|
157 |
LOG_FUNC_ENTRY("CATModule2::AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress )");
|
|
158 |
if ( m_pAddressToLine == 0 && ! m_bAddressToLineInitialized )
|
|
159 |
{
|
|
160 |
// Use addr2line.exe to locate codelines on armv5 and gcce platform.
|
|
161 |
m_pAddressToLine = new CATAddr2line();
|
|
162 |
|
|
163 |
// Create full path to binary .sym file which we open using addr2line.exe.
|
|
164 |
string sFullPathToBinary = GetBinaryFile();
|
|
165 |
|
|
166 |
// If opening of binary not succesfull set return value to false.
|
|
167 |
if ( ! m_pAddressToLine->Open( sFullPathToBinary, pMemoryAddress->GetModuleStartAddress() ) )
|
|
168 |
{
|
|
169 |
LOG_STRING("Error, m_pAddressToLine->Open()");
|
|
170 |
return false;
|
|
171 |
}
|
|
172 |
m_bAddressToLineInitialized = true;
|
|
173 |
}
|
|
174 |
// Check pointer before calling.
|
|
175 |
if ( m_pAddressToLine == 0 )
|
|
176 |
return false;
|
|
177 |
|
|
178 |
m_pAddressToLine->AddressToLine( pMemoryAddress );
|
|
179 |
return true;
|
|
180 |
}
|
|
181 |
|
|
182 |
// Find symbol of given address
|
|
183 |
int CATModule2::GetSymbolIndexUsingAddress( unsigned long iAddress ) const
|
|
184 |
{
|
|
185 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetSymbolIndexUsingAddress");
|
|
186 |
for( size_t i = 0; i < m_vMapFileFuncList.size(); i++ )
|
|
187 |
{
|
|
188 |
unsigned long iStart = m_vMapFileFuncList.at( i ).iAddress;
|
|
189 |
unsigned long iEnd = ( m_vMapFileFuncList.at( i ).iAddress
|
|
190 |
+ m_vMapFileFuncList.at( i ).iFuncLength );
|
|
191 |
|
|
192 |
if ( iAddress >= iStart && iAddress < iEnd )
|
|
193 |
return (int) i;
|
|
194 |
}
|
|
195 |
return -1;
|
|
196 |
}
|
|
197 |
|
|
198 |
// Find index of function line in file vector of given symbolname
|
|
199 |
int CATModule2::GetLineInFileIndexUsingSymbolName( const string& sSymbolName ) const
|
|
200 |
{
|
|
201 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetLineInFileIndexUsingSymbolName");
|
|
202 |
for( size_t i = 0; i < m_vLineInFile.size(); i++ )
|
|
203 |
{
|
|
204 |
string sLineInFileName = m_vLineInFile.at( i ).sFunction;
|
|
205 |
if( sLineInFileName.find( sSymbolName ) != string::npos )
|
|
206 |
{
|
|
207 |
return (int) i;
|
|
208 |
}
|
|
209 |
}
|
|
210 |
return -1;
|
|
211 |
}
|
|
212 |
|
|
213 |
|
|
214 |
// Check does modules symbol file(s) exist.
|
|
215 |
bool CATModule2::SymbolFileExist( void )
|
|
216 |
{
|
|
217 |
LOG_FUNC_ENTRY("CATModule2::SymbolFileExist");
|
|
218 |
string sFullPathToSym = GetSymbolFile();
|
|
219 |
if ( !FileExists( sFullPathToSym.c_str() ) )
|
|
220 |
{
|
|
221 |
// Add missing symbol file to error string.
|
|
222 |
m_sErrors.append( "Missing symbol file: " );
|
|
223 |
m_sErrors.append( sFullPathToSym );
|
|
224 |
m_sErrors.append( "\n" );
|
|
225 |
return false;
|
|
226 |
}
|
|
227 |
return true;
|
|
228 |
}
|
|
229 |
|
|
230 |
// Check does modules map file(s) exists.
|
|
231 |
bool CATModule2::MapFileExist( void )
|
|
232 |
{
|
|
233 |
LOG_FUNC_ENTRY("CATModule2::MapFileExist");
|
|
234 |
string sFullPathToMap = GetMapFile();
|
|
235 |
if ( !FileExists( sFullPathToMap.c_str() ) )
|
|
236 |
{
|
|
237 |
// Add missing symbol file to error string.
|
|
238 |
m_sErrors.append( "Missing map file: " );
|
|
239 |
m_sErrors.append( sFullPathToMap );
|
|
240 |
m_sErrors.append( "\n" );
|
|
241 |
return false;
|
|
242 |
}
|
|
243 |
return true;
|
|
244 |
}
|
|
245 |
|
|
246 |
//Check does modules binary file(s) exist.
|
|
247 |
bool CATModule2::BinaryFileExist( void )
|
|
248 |
{
|
|
249 |
LOG_FUNC_ENTRY("CATModule2::BinaryFileExist");
|
|
250 |
string sFullPathToBinary = GetBinaryFile();
|
|
251 |
if ( ! FileExists( sFullPathToBinary.c_str() ) )
|
|
252 |
{
|
|
253 |
// Add missing binary to error string.
|
|
254 |
m_sErrors.append( "Missing binary file: " );
|
|
255 |
m_sErrors.append( sFullPathToBinary );
|
|
256 |
m_sErrors.append( "\n" );
|
|
257 |
return false;
|
|
258 |
}
|
|
259 |
return true;
|
|
260 |
}
|
|
261 |
|
|
262 |
void CATModule2::AddSource(const string &sSourceFile, const string& sLstFile)
|
|
263 |
{
|
|
264 |
LOG_LOW_FUNC_ENTRY("CATModule2::AddSource");
|
|
265 |
// Parse sources which are separated by spaces
|
|
266 |
if( sSourceFile.length() < 1 || sLstFile.length() < 1 )
|
|
267 |
return;
|
|
268 |
|
|
269 |
// Skip if its temporary cpp.
|
|
270 |
if ( sSourceFile.find( AT_TEMP_CPP_LOWER_START) != string::npos )
|
|
271 |
return;
|
|
272 |
|
|
273 |
// Source structure
|
|
274 |
SOURCE sNew;
|
|
275 |
sNew.sCpp = sSourceFile;
|
|
276 |
sNew.sLst = sLstFile;
|
|
277 |
|
|
278 |
// Verify paths.
|
|
279 |
ConvertUnixPathToWin( sNew.sCpp );
|
|
280 |
ConvertUnixPathToWin( sNew.sLst );
|
|
281 |
|
|
282 |
// Lower case them.
|
|
283 |
ChangeToLower( sNew.sCpp );
|
|
284 |
ChangeToLower( sNew.sLst );
|
|
285 |
|
|
286 |
// Add it
|
|
287 |
m_vSources.push_back( sNew );
|
|
288 |
}
|
|
289 |
|
|
290 |
void CATModule2::AddSources(string& sSource)
|
|
291 |
{
|
|
292 |
LOG_LOW_FUNC_ENTRY("CATModule2::AddSources");
|
|
293 |
// Parse sources which are separated by spaces
|
|
294 |
if( sSource.length() < 1 )
|
|
295 |
return;
|
|
296 |
// Source structure
|
|
297 |
SOURCE sNew;
|
|
298 |
size_t iSpot = string::npos;
|
|
299 |
iSpot = sSource.find( " " );
|
|
300 |
while( iSpot != string::npos )
|
|
301 |
{
|
|
302 |
// Pickup source
|
|
303 |
sNew.sCpp = sSource.substr(0, iSpot);
|
|
304 |
// Convert path from Unix to Win
|
|
305 |
ConvertUnixPathToWin( sNew.sCpp );
|
|
306 |
// Lowercase it
|
|
307 |
ChangeToLower( sNew.sCpp );
|
|
308 |
// If its temp skip this
|
|
309 |
if ( sNew.sCpp.find( AT_TEMP_CPP_LOWER_START ) == string::npos )
|
|
310 |
{
|
|
311 |
// Get corresponding lst file for source
|
|
312 |
sNew.sLst = GetLstNameOfSource( sNew.sCpp );
|
|
313 |
m_vSources.push_back( sNew );
|
|
314 |
// Remove it from sSource
|
|
315 |
sSource.erase(0,iSpot+1);
|
|
316 |
// Find new one
|
|
317 |
}
|
|
318 |
iSpot = sSource.find( " " );
|
|
319 |
}
|
|
320 |
// Pickup last or only one source
|
|
321 |
sNew.sCpp = sSource;
|
|
322 |
// Convert path from unix to win
|
|
323 |
ConvertUnixPathToWin( sNew.sCpp );
|
|
324 |
// Lowercase it
|
|
325 |
ChangeToLower( sNew.sCpp );
|
|
326 |
// Lst name
|
|
327 |
sNew.sLst = GetLstNameOfSource( sNew.sCpp );
|
|
328 |
if ( sNew.sCpp.find( AT_TEMP_CPP_LOWER_START ) == string::npos )
|
|
329 |
{
|
|
330 |
// Get corresponding lst file for source
|
|
331 |
sNew.sLst = GetLstNameOfSource( sNew.sCpp );
|
|
332 |
m_vSources.push_back( sNew );
|
|
333 |
}
|
|
334 |
}
|
|
335 |
bool CATModule2::CreateTempCpp(const string& sS60FileName
|
|
336 |
, int eLoggingMode
|
|
337 |
, int eBuildType
|
|
338 |
, int iAllocCallStackSize
|
|
339 |
, int iFreeCallStackSize )
|
|
340 |
{
|
|
341 |
LOG_FUNC_ENTRY("CATModule2::CreateTemporaryCpp");
|
|
342 |
// S60 filename
|
|
343 |
m_sS60FileName = sS60FileName;
|
|
344 |
// Make s60 filename target.type.dat if its empty and logging mode is file
|
|
345 |
if ( eLoggingMode == CATProject::FILE
|
|
346 |
&& m_sS60FileName.empty() )
|
|
347 |
{
|
|
348 |
m_sS60FileName = m_sTarget;
|
|
349 |
m_sS60FileName.append(".");
|
|
350 |
m_sS60FileName.append( m_sTargetType );
|
|
351 |
m_sS60FileName.append(".dat");
|
|
352 |
}
|
|
353 |
return CreateTemporaryCpp( GetUniqueId(), m_sTempPath,
|
|
354 |
m_sS60FileName, eLoggingMode, eBuildType, iAllocCallStackSize, iFreeCallStackSize );
|
|
355 |
}
|
|
356 |
|
|
357 |
bool CATModule2::ModifyMmp()
|
|
358 |
{
|
|
359 |
LOG_FUNC_ENTRY("CATModule2::ModifyMmp");
|
|
360 |
// Create backup
|
|
361 |
if ( ! m_Mmp.BackupMmpFile() )
|
|
362 |
return false;
|
|
363 |
// Hook
|
|
364 |
return m_Mmp.EditMmpFile( m_sTargetType, GetUniqueId() );
|
|
365 |
}
|
|
366 |
|
|
367 |
bool CATModule2::RestoreMmp()
|
|
368 |
{
|
|
369 |
LOG_FUNC_ENTRY("CATModule2::RestoreMmp");
|
|
370 |
// Restore mmp from backup
|
|
371 |
return m_Mmp.RestoreMmpFile();
|
|
372 |
}
|
|
373 |
|
|
374 |
bool CATModule2::VerifyAndRecoverMmp()
|
|
375 |
{
|
|
376 |
LOG_FUNC_ENTRY("CATModule2::VerifyAndRecoverMmp");
|
|
377 |
// Verify mmp
|
|
378 |
return m_Mmp.VerifyAndRecover();
|
|
379 |
}
|
|
380 |
|
|
381 |
// ----------------------------------------------------------------------------
|
|
382 |
// Releasables Handling methos
|
|
383 |
// ----------------------------------------------------------------------------
|
|
384 |
bool CATModule2::CopyReleasables()
|
|
385 |
{
|
|
386 |
LOG_FUNC_ENTRY("CATModule2::CopyReleasables");
|
|
387 |
bool bRet = true;
|
|
388 |
if ( ! CopyLstFilesToTemp() )
|
|
389 |
bRet = false;
|
|
390 |
if ( ! CopyMapFileToTemp() )
|
|
391 |
bRet = false;
|
|
392 |
return bRet;
|
|
393 |
}
|
|
394 |
|
|
395 |
bool CATModule2::CopyLstFilesToDir( const string& sDir )
|
|
396 |
{
|
|
397 |
LOG_FUNC_ENTRY("CATModule2::CopyLstFilesToDir");
|
|
398 |
bool bRet = true;
|
|
399 |
// Copy lst files to given directory.
|
|
400 |
vector<SOURCE>::const_iterator source;
|
|
401 |
for( source = m_vSources.begin(); source != m_vSources.end() ; source++ )
|
|
402 |
{
|
|
403 |
if ( ! FileCopyToPath( source->sLst, sDir ) )
|
|
404 |
{
|
|
405 |
if ( !FileExists( source->sLst.c_str() ) )
|
|
406 |
{
|
|
407 |
m_sErrors.append( "Missing listing file: " );
|
|
408 |
m_sErrors.append( source->sLst );
|
|
409 |
m_sErrors.append( "\n" );
|
|
410 |
}
|
|
411 |
if ( !DirectoryExists( sDir.c_str() ) )
|
|
412 |
{
|
|
413 |
m_sErrors.append( "Missing folder: " );
|
|
414 |
m_sErrors.append( sDir );
|
|
415 |
m_sErrors.append( "\n" );
|
|
416 |
}
|
|
417 |
bRet = false;
|
|
418 |
}
|
|
419 |
}
|
|
420 |
// Return.
|
|
421 |
return bRet;
|
|
422 |
}
|
|
423 |
|
|
424 |
bool CATModule2::CopyLstFilesToTemp()
|
|
425 |
{
|
|
426 |
LOG_FUNC_ENTRY("CATModule2::CopyLstFilesToTemp");
|
|
427 |
// Return boolean
|
|
428 |
bool bRet = true;
|
|
429 |
// Move all lst files except tmp cpp
|
|
430 |
vector<SOURCE>::iterator it = m_vSources.begin();
|
|
431 |
while ( it != m_vSources.end() )
|
|
432 |
{
|
|
433 |
if ( !FileCopyToPath( it->sLst, m_sTempPath ) )
|
|
434 |
{
|
|
435 |
if ( !FileExists( it->sLst.c_str() ) )
|
|
436 |
{
|
|
437 |
m_sErrors.append( "Missing listing file: " );
|
|
438 |
m_sErrors.append( it->sLst );
|
|
439 |
m_sErrors.append( "\n" );
|
|
440 |
}
|
|
441 |
if ( !DirectoryExists( m_sTempPath.c_str() ) )
|
|
442 |
{
|
|
443 |
m_sErrors.append( "Missing folder: " );
|
|
444 |
m_sErrors.append( m_sTempPath );
|
|
445 |
m_sErrors.append( "\n" );
|
|
446 |
}
|
|
447 |
bRet = false;
|
|
448 |
}
|
|
449 |
it++;
|
|
450 |
}
|
|
451 |
return bRet;
|
|
452 |
}
|
|
453 |
|
|
454 |
bool CATModule2::DeleteLstFilesFromSrc( void )
|
|
455 |
{
|
|
456 |
LOG_FUNC_ENTRY("CATModule2::DeleteLstFilesFromSrc");
|
|
457 |
vector<SOURCE>::iterator it = m_vSources.begin();
|
|
458 |
bool bRet = true;
|
|
459 |
// Delete lst files
|
|
460 |
while ( it != m_vSources.end() )
|
|
461 |
{
|
|
462 |
if ( ! FileDelete( it->sLst, true ) )
|
|
463 |
bRet = false;
|
|
464 |
it++;
|
|
465 |
}
|
|
466 |
return bRet;
|
|
467 |
}
|
|
468 |
|
|
469 |
bool CATModule2::CopyMapFileToTemp()
|
|
470 |
{
|
|
471 |
LOG_FUNC_ENTRY("CATModule2::CopyMapFileToTemp");
|
|
472 |
// Return boolean
|
|
473 |
bool bRet = true;
|
|
474 |
// Map File to copy
|
|
475 |
string sMapFile = GetMapFile();
|
|
476 |
if ( !FileCopyToPath( sMapFile, m_sTempPath ) )
|
|
477 |
{
|
|
478 |
bRet = false;
|
|
479 |
if ( !FileExists( sMapFile.c_str() ) )
|
|
480 |
{
|
|
481 |
// Add missing map file to error string.
|
|
482 |
m_sErrors.append( "Missing map file: " );
|
|
483 |
m_sErrors.append( sMapFile );
|
|
484 |
m_sErrors.append( "\n" );
|
|
485 |
}
|
|
486 |
if ( !DirectoryExists( m_sTempPath.c_str() ) )
|
|
487 |
{
|
|
488 |
// Add missing temporary folder
|
|
489 |
m_sErrors.append( "Missing folder: " );
|
|
490 |
m_sErrors.append( m_sTempPath );
|
|
491 |
m_sErrors.append( "\n" );
|
|
492 |
}
|
|
493 |
}
|
|
494 |
return bRet;
|
|
495 |
}
|
|
496 |
|
|
497 |
bool CATModule2::CleanTemporaryDir()
|
|
498 |
{
|
|
499 |
LOG_FUNC_ENTRY("CATModule2::CleanTemporaryDir");
|
|
500 |
bool bRet = true;
|
|
501 |
// Verify mmp
|
|
502 |
if ( ! m_Mmp.VerifyAndRecover() )
|
|
503 |
bRet = false;
|
|
504 |
// Clean temporary dir
|
|
505 |
vector<string> vFileList = DirList( m_sTempPath, false , true );
|
|
506 |
vector<string>::iterator it = vFileList.begin();
|
|
507 |
// Size of constant table
|
|
508 |
int iCount = sizeof( TEMP_EXTENSION_NO_DELETE ) / sizeof( string );
|
|
509 |
while ( it != vFileList.end() )
|
|
510 |
{
|
|
511 |
// Get extension and compare it to list
|
|
512 |
bool bDelete = true;
|
|
513 |
string sExtension = GetExtension( *it );
|
|
514 |
ChangeToLower( sExtension );
|
|
515 |
for ( int i = 0 ; i < iCount ; i++ )
|
|
516 |
{
|
|
517 |
if( sExtension.compare( TEMP_EXTENSION_NO_DELETE[i] ) == 0 )
|
|
518 |
{
|
|
519 |
bDelete = false;
|
|
520 |
break;
|
|
521 |
}
|
|
522 |
}
|
|
523 |
if ( bDelete )
|
|
524 |
{
|
|
525 |
// Delete file
|
|
526 |
if ( ! FileDelete( *it, true ) )
|
|
527 |
bRet = false;
|
|
528 |
}
|
|
529 |
// Increment
|
|
530 |
it++;
|
|
531 |
}
|
|
532 |
return bRet;
|
|
533 |
}
|
|
534 |
|
|
535 |
bool CATModule2::DeleteTemporaryDir()
|
|
536 |
{
|
|
537 |
LOG_FUNC_ENTRY("CATModule2::DeleteTemporaryDir");
|
|
538 |
bool bRet = true;
|
|
539 |
// Verify mmp
|
|
540 |
if ( ! m_Mmp.VerifyAndRecover() )
|
|
541 |
bRet = false;
|
|
542 |
// Delete temp dir
|
|
543 |
if ( !DirDelete( m_sTempPath, true ) )
|
|
544 |
bRet = false;
|
|
545 |
return bRet;
|
|
546 |
}
|
|
547 |
|
|
548 |
bool CATModule2::IsUDEB() const
|
|
549 |
{
|
|
550 |
LOG_LOW_FUNC_ENTRY("CATModule2::IsUDEB");
|
|
551 |
// Determine from variant is this udeb
|
|
552 |
if ( m_sVariantType.find( "udeb" ) != string::npos )
|
|
553 |
return true;
|
|
554 |
return false;
|
|
555 |
}
|
|
556 |
// ----------------------------------------------------------------------------
|
|
557 |
// Private AddressToLine related methods
|
|
558 |
// ----------------------------------------------------------------------------
|
|
559 |
bool CATModule2::InitializeAddressToLine()
|
|
560 |
{
|
|
561 |
LOG_FUNC_ENTRY("CATModule2::InitializeAddressToLine");
|
|
562 |
bool bRet = true;
|
|
563 |
// Read in different way depending on platform
|
|
564 |
if ( m_sVariantPlatform.compare("armv5") == 0 )
|
|
565 |
{
|
|
566 |
// Add static library lst files to source vector,
|
|
567 |
// before reading them.
|
|
568 |
vector<string> vFiles = DirList( AT_TEMP_LST_DIR, false, true );
|
|
569 |
for(vector<string>::iterator it = vFiles.begin() ; it != vFiles.end() ; it ++ )
|
|
570 |
{
|
|
571 |
SOURCE source;
|
|
572 |
source.bStatic = true;
|
|
573 |
source.sLst = *it;
|
|
574 |
source.sCpp = *it;
|
|
575 |
source.sCpp = CATBase::RemovePathAndExt( source.sCpp, false );
|
|
576 |
source.sCpp.append( ".cpp" );
|
|
577 |
m_vSources.push_back( source );
|
|
578 |
}
|
|
579 |
|
|
580 |
if ( ! ReadListingFilesArmv5() )
|
|
581 |
bRet = false;
|
|
582 |
if ( ! ReadMapFileArmv5() )
|
|
583 |
bRet = false;
|
|
584 |
|
|
585 |
if ( bRet )
|
|
586 |
m_bAddressToLineInitialized = true;
|
|
587 |
}
|
|
588 |
return bRet;
|
|
589 |
}
|
|
590 |
|
|
591 |
|
|
592 |
bool CATModule2::ReadListingFilesArmv5()
|
|
593 |
{
|
|
594 |
LOG_FUNC_ENTRY("CATModule2::ReadListingFilesArmv5");
|
|
595 |
char cTemp[MAX_LINE_LENGTH];
|
|
596 |
vector<SOURCE>::iterator viFileIter = m_vSources.begin();
|
|
597 |
int iNumberOfLstFiles = (int)m_vSources.size();
|
|
598 |
vector<string> vTempLines;
|
|
599 |
string sFileName;
|
|
600 |
|
|
601 |
// Open all .lst files
|
|
602 |
while( iNumberOfLstFiles > 0 )
|
|
603 |
{
|
|
604 |
// Make .lst file name
|
|
605 |
sFileName.clear();
|
|
606 |
|
|
607 |
// If lst file is not from static library make path to modules temporary directory.
|
|
608 |
if ( viFileIter->bStatic != true )
|
|
609 |
{
|
|
610 |
// Remove path
|
|
611 |
if( viFileIter->sLst.find("\\") != string::npos )
|
|
612 |
sFileName.append(
|
|
613 |
viFileIter->sLst.substr( viFileIter->sLst.find_last_of( "\\" ) + 1
|
|
614 |
, viFileIter->sLst.size() ) );
|
|
615 |
else
|
|
616 |
sFileName.append( viFileIter->sLst );
|
|
617 |
|
|
618 |
// Add temporary dir
|
|
619 |
sFileName.insert( 0, m_sTempPath );
|
|
620 |
}
|
|
621 |
else
|
|
622 |
{
|
|
623 |
// Lst from static library don't change path.
|
|
624 |
sFileName = viFileIter->sLst;
|
|
625 |
}
|
|
626 |
// Open lst file
|
|
627 |
ifstream in( sFileName.c_str() );
|
|
628 |
|
|
629 |
// If file can not be opened, try to open next file
|
|
630 |
if( !in.good() )
|
|
631 |
{
|
|
632 |
viFileIter++;
|
|
633 |
iNumberOfLstFiles--;
|
|
634 |
continue;
|
|
635 |
}
|
|
636 |
|
|
637 |
string sTemp;
|
|
638 |
// Clear temporary lines
|
|
639 |
vTempLines.clear();
|
|
640 |
// Add all lines to temp list
|
|
641 |
do
|
|
642 |
{
|
|
643 |
in.getline( cTemp, MAX_LINE_LENGTH );
|
|
644 |
sTemp.clear();
|
|
645 |
sTemp.append( cTemp );
|
|
646 |
vTempLines.push_back( sTemp );
|
|
647 |
}
|
|
648 |
while( in.good() );
|
|
649 |
|
|
650 |
LINE_IN_FILE structLineInFile;
|
|
651 |
|
|
652 |
bool bFindENDP = false;
|
|
653 |
vector<string>::iterator viLinesIter = vTempLines.begin();
|
|
654 |
|
|
655 |
// Loop throw all lines in .lst file
|
|
656 |
while( viLinesIter != vTempLines.end() )
|
|
657 |
{
|
|
658 |
// Find ";;;"
|
|
659 |
if( !bFindENDP && strstr(viLinesIter->c_str(), ";;;") != NULL )
|
|
660 |
{
|
|
661 |
bFindENDP = true;
|
|
662 |
|
|
663 |
vector<string>::iterator viLineTempIter = viLinesIter;
|
|
664 |
|
|
665 |
// Find top line of function definition
|
|
666 |
while( viLineTempIter->size() > 0 )
|
|
667 |
{
|
|
668 |
viLineTempIter--;
|
|
669 |
}
|
|
670 |
viLineTempIter++;
|
|
671 |
structLineInFile.sFunction.clear();
|
|
672 |
structLineInFile.sFunction.append( viLineTempIter->c_str() );
|
|
673 |
|
|
674 |
viLinesIter++;
|
|
675 |
// Get Line
|
|
676 |
sTemp.clear();
|
|
677 |
sTemp.append( viLinesIter->c_str() );
|
|
678 |
sTemp.erase(0,3);
|
|
679 |
size_t iSize = sTemp.find_first_of(' ');
|
|
680 |
if( iSize != string::npos )
|
|
681 |
sTemp.resize(iSize);
|
|
682 |
structLineInFile.iLine = atoi( sTemp.c_str() );
|
|
683 |
|
|
684 |
structLineInFile.sFileName.clear();
|
|
685 |
structLineInFile.sFileName.append( viFileIter->sCpp.c_str() );
|
|
686 |
structLineInFile.sLstName = sFileName;
|
|
687 |
m_vLineInFile.push_back( structLineInFile );
|
|
688 |
}
|
|
689 |
else if( strstr(viLinesIter->c_str(), "ENDP") != NULL )
|
|
690 |
bFindENDP = false;
|
|
691 |
viLinesIter++;
|
|
692 |
}
|
|
693 |
viFileIter++;
|
|
694 |
iNumberOfLstFiles--;
|
|
695 |
}
|
|
696 |
if( m_vLineInFile.size() > 0 )
|
|
697 |
return true;
|
|
698 |
return false;
|
|
699 |
}
|
|
700 |
|
|
701 |
bool CATModule2::ReadMapFileArmv5()
|
|
702 |
{
|
|
703 |
LOG_FUNC_ENTRY("CATModule2::ReadMapFileArmv5");
|
|
704 |
// Map file name
|
|
705 |
string sMapFileName = GetMapFile();
|
|
706 |
// Remove path
|
|
707 |
if ( sMapFileName.find("\\") != string::npos )
|
|
708 |
sMapFileName.erase(0, sMapFileName.find_last_of('\\')+1 );
|
|
709 |
// Add temp path
|
|
710 |
sMapFileName.insert(0, m_sTempPath );
|
|
711 |
|
|
712 |
// Open .map file
|
|
713 |
ifstream in( sMapFileName.c_str() );
|
|
714 |
|
|
715 |
// File open ok?
|
|
716 |
if( ! in.good() )
|
|
717 |
{
|
|
718 |
in.close();
|
|
719 |
return false;
|
|
720 |
}
|
|
721 |
char cTemp[MAX_LINE_LENGTH];
|
|
722 |
bool bFirstFuncFound = false;
|
|
723 |
// Get all lines where is "Thumb"
|
|
724 |
do
|
|
725 |
{
|
|
726 |
// Load one line from .map file
|
|
727 |
in.getline( cTemp, MAX_LINE_LENGTH );
|
|
728 |
// Find _E32Startup
|
|
729 |
if( !bFirstFuncFound && ( strstr( cTemp, "_E32Startup" ) != NULL) )
|
|
730 |
{
|
|
731 |
bFirstFuncFound = true;
|
|
732 |
}
|
|
733 |
else if( !bFirstFuncFound && ( strstr( cTemp, "_E32Dll" ) != NULL) )
|
|
734 |
{
|
|
735 |
bFirstFuncFound = true;
|
|
736 |
}
|
|
737 |
else if( !bFirstFuncFound )
|
|
738 |
// Skip if _E32Startup not found
|
|
739 |
continue;
|
|
740 |
|
|
741 |
if( strstr( cTemp, "Thumb Code" ) != NULL || strstr( cTemp, "ARM Code" ) != NULL)
|
|
742 |
{
|
|
743 |
MAP_FUNC_INFO structMapFileLineInfo;
|
|
744 |
structMapFileLineInfo.sWholeLine.append( cTemp );
|
|
745 |
|
|
746 |
// Get memory string address from line
|
|
747 |
char* pStart = strstr( cTemp, "0x" );
|
|
748 |
// Check did strstr return null.
|
|
749 |
if( pStart == NULL )
|
|
750 |
continue;
|
|
751 |
char* pTemp = pStart;
|
|
752 |
char TempString[MAX_LINE_LENGTH];
|
|
753 |
TempString[0] = 0;
|
|
754 |
size_t iLength = 0;
|
|
755 |
while( *pTemp != ' ' )
|
|
756 |
{
|
|
757 |
TempString[iLength] = *pTemp;
|
|
758 |
pTemp++;
|
|
759 |
iLength++;
|
|
760 |
}
|
|
761 |
TempString[iLength] = 0;
|
|
762 |
|
|
763 |
structMapFileLineInfo.iAddress = CATDatParser::_httoi( TempString );
|
|
764 |
|
|
765 |
pTemp = cTemp;
|
|
766 |
TempString[0] = 0;
|
|
767 |
|
|
768 |
// Get function name
|
|
769 |
|
|
770 |
// Skip spaces
|
|
771 |
while( *pTemp == ' ' )
|
|
772 |
{
|
|
773 |
pTemp++;
|
|
774 |
}
|
|
775 |
iLength = 0;
|
|
776 |
// Find end of function name
|
|
777 |
string sTemp( pTemp );
|
|
778 |
|
|
779 |
// Location of character ')'
|
|
780 |
iLength = sTemp.find_first_of(')');
|
|
781 |
|
|
782 |
// Location of character ' '
|
|
783 |
size_t iLength2 = sTemp.find_first_of(' ');
|
|
784 |
|
|
785 |
// If ')' character is the last char and
|
|
786 |
// character ' ' is closer than ')' use location of ' '
|
|
787 |
if( ( iLength + 1 ) == sTemp.length() && iLength2 < iLength )
|
|
788 |
iLength = iLength2 - 1;
|
|
789 |
|
|
790 |
if( iLength != string::npos )
|
|
791 |
sTemp.resize( (iLength + 1) );
|
|
792 |
|
|
793 |
structMapFileLineInfo.sFunctionName.append( sTemp.c_str() );
|
|
794 |
|
|
795 |
bool bARM = false;
|
|
796 |
// Find function length
|
|
797 |
pStart = strstr( cTemp, "Thumb Code" );
|
|
798 |
if( pStart == NULL )
|
|
799 |
{
|
|
800 |
pStart = strstr( cTemp, "ARM Code" );
|
|
801 |
bARM = true;
|
|
802 |
}
|
|
803 |
if( pStart != NULL )
|
|
804 |
{
|
|
805 |
if( bARM )
|
|
806 |
pStart += 8;
|
|
807 |
else
|
|
808 |
pStart += 10;
|
|
809 |
while(*pStart == ' ')
|
|
810 |
{
|
|
811 |
pStart++;
|
|
812 |
}
|
|
813 |
sTemp.clear();
|
|
814 |
sTemp.append( pStart );
|
|
815 |
size_t iSize = sTemp.find_first_of(' ');
|
|
816 |
if( iSize != string::npos )
|
|
817 |
sTemp.resize( iSize );
|
|
818 |
}
|
|
819 |
|
|
820 |
structMapFileLineInfo.iFuncLength = atoi( sTemp.c_str() );
|
|
821 |
if( bFirstFuncFound && structMapFileLineInfo.iFuncLength > 0 )
|
|
822 |
// Save to list
|
|
823 |
m_vMapFileFuncList.push_back( structMapFileLineInfo );
|
|
824 |
}
|
|
825 |
}
|
|
826 |
while( in.good() );
|
|
827 |
in.close();
|
|
828 |
return true;
|
|
829 |
}
|
|
830 |
|
|
831 |
int CATModule2::FindLeakCodeLine( string& sFileName, int iLine, unsigned long iFromFuncAddress ) const
|
|
832 |
{
|
|
833 |
LOG_LOW_FUNC_ENTRY("CATModule2::FindLeakCodeLine");
|
|
834 |
if ( sFileName.empty() )
|
|
835 |
return -1;
|
|
836 |
char cLineFromFile[MAX_LINE_LENGTH];
|
|
837 |
vector<string> vTempLines;
|
|
838 |
string sTemp;
|
|
839 |
char* pTemp = NULL;
|
|
840 |
char* pTempEnd = NULL;
|
|
841 |
int iFoundLine = -1;
|
|
842 |
int iRet = -1;
|
|
843 |
|
|
844 |
// Open lst file
|
|
845 |
ifstream in( sFileName.c_str() );
|
|
846 |
|
|
847 |
bool bLineFound = false;
|
|
848 |
bool bFirstAddressInFuncFound = false;
|
|
849 |
unsigned long iFirstAddressInFunc = 0;
|
|
850 |
while( in.good() )
|
|
851 |
{
|
|
852 |
in.getline( cLineFromFile, MAX_LINE_LENGTH );
|
|
853 |
|
|
854 |
if( bLineFound )
|
|
855 |
{
|
|
856 |
vTempLines.push_back( cLineFromFile );
|
|
857 |
// Is first character digit
|
|
858 |
if( isdigit( cLineFromFile[0] ) )
|
|
859 |
{
|
|
860 |
if( !bFirstAddressInFuncFound )
|
|
861 |
{
|
|
862 |
bFirstAddressInFuncFound = true;
|
|
863 |
sTemp.clear();
|
|
864 |
sTemp.append( cLineFromFile );
|
|
865 |
// Get value until next space
|
|
866 |
sTemp.resize( sTemp.find_first_of(' ') );
|
|
867 |
|
|
868 |
iFirstAddressInFunc = CATDatParser::_httoi( sTemp.c_str() );
|
|
869 |
|
|
870 |
// Return function start line if margin 0
|
|
871 |
if( iFromFuncAddress == 0 )
|
|
872 |
{
|
|
873 |
iRet = iLine;
|
|
874 |
return iRet;
|
|
875 |
}
|
|
876 |
}
|
|
877 |
else
|
|
878 |
{
|
|
879 |
// Find correct line using iFromFuncAddress variable
|
|
880 |
sTemp.clear();
|
|
881 |
sTemp.append( cLineFromFile );
|
|
882 |
// Get value until next space
|
|
883 |
sTemp.resize( sTemp.find_first_of(' ') );
|
|
884 |
|
|
885 |
unsigned long iValue = CATDatParser::_httoi( sTemp.c_str() );
|
|
886 |
|
|
887 |
if( ( iValue - iFirstAddressInFunc ) >= iFromFuncAddress )
|
|
888 |
{
|
|
889 |
// If there is data in function, code line can not be found
|
|
890 |
if( strstr( cLineFromFile , "DCB" ) != NULL )
|
|
891 |
{
|
|
892 |
iRet = -1;
|
|
893 |
return iRet;
|
|
894 |
}
|
|
895 |
pTemp = strstr( cLineFromFile, ";" );
|
|
896 |
// Get line number
|
|
897 |
bool bStringNumber = true;
|
|
898 |
if( pTemp != NULL )
|
|
899 |
{
|
|
900 |
string sTempLine( pTemp + 1 );
|
|
901 |
// Are all characters numbers?
|
|
902 |
for( unsigned int i = 0 ; i < sTempLine .size() ; i++ )
|
|
903 |
{
|
|
904 |
if( !isdigit(sTempLine[i]) )
|
|
905 |
{
|
|
906 |
bStringNumber = false;
|
|
907 |
break;
|
|
908 |
}
|
|
909 |
}
|
|
910 |
}
|
|
911 |
else
|
|
912 |
bStringNumber = false;
|
|
913 |
if( bStringNumber )
|
|
914 |
{
|
|
915 |
pTemp++;
|
|
916 |
// Get line number
|
|
917 |
iRet = atoi( pTemp );
|
|
918 |
}
|
|
919 |
else
|
|
920 |
{
|
|
921 |
vector<string>::iterator sTempIter = vTempLines.end();
|
|
922 |
|
|
923 |
sTempIter--;
|
|
924 |
|
|
925 |
// Find last code line
|
|
926 |
while( sTempIter != vTempLines.begin() )
|
|
927 |
{
|
|
928 |
if( strstr( sTempIter->c_str() , "DCB" ) != NULL )
|
|
929 |
{
|
|
930 |
iRet = -1;
|
|
931 |
return iRet;
|
|
932 |
}
|
|
933 |
if( strstr( sTempIter->c_str() , ";;;" ) == NULL )
|
|
934 |
sTempIter--;
|
|
935 |
else
|
|
936 |
break;
|
|
937 |
}
|
|
938 |
if(sTempIter == vTempLines.begin() && strstr( sTempIter->c_str() , ";;;" ) == NULL)
|
|
939 |
{
|
|
940 |
iRet = -1;
|
|
941 |
return iRet;
|
|
942 |
}
|
|
943 |
sTempIter->erase( 0, 3 );
|
|
944 |
sTempIter->resize( sTempIter->find(' ') );
|
|
945 |
|
|
946 |
// Leak line
|
|
947 |
iRet = atoi( sTempIter->c_str() );
|
|
948 |
}
|
|
949 |
return iRet;
|
|
950 |
}
|
|
951 |
}
|
|
952 |
}
|
|
953 |
}
|
|
954 |
else // Line in file not found
|
|
955 |
{
|
|
956 |
// Find line of function
|
|
957 |
if( strstr( cLineFromFile, ";;;" ) != NULL )
|
|
958 |
{
|
|
959 |
pTemp = &cLineFromFile[0];
|
|
960 |
// Skip characters ";;;"
|
|
961 |
pTemp += 3;
|
|
962 |
pTempEnd = pTemp;
|
|
963 |
// Find end of line number
|
|
964 |
while( *pTempEnd != ' ' )
|
|
965 |
{
|
|
966 |
pTempEnd++;
|
|
967 |
}
|
|
968 |
*pTempEnd = 0;
|
|
969 |
iFoundLine = atoi( pTemp );
|
|
970 |
*pTempEnd = ' ';
|
|
971 |
if( iLine == iFoundLine )
|
|
972 |
{
|
|
973 |
bLineFound = true;
|
|
974 |
}
|
|
975 |
}
|
|
976 |
}
|
|
977 |
}
|
|
978 |
return iRet;
|
|
979 |
}
|
|
980 |
|
|
981 |
bool CATModule2::IsMakeSuccessfull()
|
|
982 |
{
|
|
983 |
LOG_FUNC_ENTRY("CATModule2::IsMakeSuccessfull");
|
|
984 |
m_sErrors.clear();
|
|
985 |
|
|
986 |
string sSearch;
|
|
987 |
bool bMakeSuccess = true;
|
|
988 |
|
|
989 |
// Lst files checked only with armv5 platform.
|
|
990 |
if ( IsPlatformArmv5() )
|
|
991 |
{
|
|
992 |
sSearch.append( m_sTempPath );
|
|
993 |
sSearch.append( "*.lst" );
|
|
994 |
if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
|
|
995 |
bMakeSuccess = false;
|
|
996 |
|
|
997 |
// Map
|
|
998 |
sSearch.clear();
|
|
999 |
sSearch.append( m_sTempPath );
|
|
1000 |
sSearch.append( "*.map" );
|
|
1001 |
if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
|
|
1002 |
bMakeSuccess = false;
|
|
1003 |
}
|
|
1004 |
|
|
1005 |
// .tmp
|
|
1006 |
sSearch.clear();
|
|
1007 |
sSearch.append( m_sTempPath );
|
|
1008 |
sSearch.append( "*.tmp" );
|
|
1009 |
if( !SearchFileWithExtension( sSearch.c_str(), false, m_sErrors ) )
|
|
1010 |
bMakeSuccess = false;
|
|
1011 |
|
|
1012 |
return bMakeSuccess;
|
|
1013 |
}
|
|
1014 |
|
|
1015 |
bool CATModule2::CreateBuildCompleteFile()
|
|
1016 |
{
|
|
1017 |
LOG_FUNC_ENTRY("CATModule2::CreateBuildCompleteFile");
|
|
1018 |
// Don't create file if temp path not set cause might be anywhere
|
|
1019 |
if ( m_sTempPath.empty() )
|
|
1020 |
return false;
|
|
1021 |
// Create empty file indicating this module is build
|
|
1022 |
string sFile = m_sTempPath;
|
|
1023 |
if( sFile.at( sFile.length() - 1 ) != '\\' )
|
|
1024 |
sFile.append("\\");
|
|
1025 |
sFile.append( "BuildComplete" );
|
|
1026 |
ofstream out( sFile.c_str() );
|
|
1027 |
out << m_sVariantPlatform << endl;
|
|
1028 |
out << m_sVariantType << endl;
|
|
1029 |
out.close();
|
|
1030 |
return true;
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
bool CATModule2::ReadMakeFileFromTemp()
|
|
1034 |
{
|
|
1035 |
LOG_FUNC_ENTRY("CATModule2::ReadMakeFileFromTemp");
|
|
1036 |
// Set makefile to point to temporary directory.
|
|
1037 |
string sMakeFile = m_sTempPath;
|
|
1038 |
sMakeFile.append( RemovePathAndExt( m_Mmp.m_sMmpFile, true ) );
|
|
1039 |
sMakeFile.append( "." );
|
|
1040 |
sMakeFile.append( AT_LEVEL_2_MAKEFILE_EXT );
|
|
1041 |
m_sMakeFile = sMakeFile;
|
|
1042 |
return ReadMakeFilePrivate();
|
|
1043 |
}
|
|
1044 |
|
|
1045 |
bool CATModule2::ReadMakeFile()
|
|
1046 |
{
|
|
1047 |
LOG_FUNC_ENTRY("CATModule2::ReadMakeFile");
|
|
1048 |
// Read makefile
|
|
1049 |
if ( ReadMakeFilePrivate() )
|
|
1050 |
{
|
|
1051 |
// Copy makefile to temporary directory.
|
|
1052 |
string sMakeFile = m_sTempPath;
|
|
1053 |
sMakeFile.append( RemovePathAndExt( m_Mmp.m_sMmpFile, true ) );
|
|
1054 |
sMakeFile.append( "." );
|
|
1055 |
sMakeFile.append( AT_LEVEL_2_MAKEFILE_EXT );
|
|
1056 |
FileCopyToPath( m_sMakeFile, sMakeFile );
|
|
1057 |
return true;
|
|
1058 |
}
|
|
1059 |
return false;
|
|
1060 |
}
|
|
1061 |
|
|
1062 |
bool CATModule2::ReadMakeFilePrivate()
|
|
1063 |
{
|
|
1064 |
LOG_FUNC_ENTRY("CATModule2::ReadMakeFilePrivate");
|
|
1065 |
|
|
1066 |
if ( m_sMakeFile.empty() )
|
|
1067 |
return false;
|
|
1068 |
|
|
1069 |
LOG_STRING( "using makefile :" << m_sMakeFile );
|
|
1070 |
|
|
1071 |
// Stream object to read files
|
|
1072 |
ifstream in;
|
|
1073 |
// Char array to read line from file
|
|
1074 |
char cLine[MAX_LINE_LENGTH];
|
|
1075 |
// String to use as buffer from file
|
|
1076 |
string sLine;
|
|
1077 |
// Open file
|
|
1078 |
in.open( m_sMakeFile.c_str(), ios_base::in );
|
|
1079 |
// Check that its open
|
|
1080 |
if ( ! in.good() )
|
|
1081 |
{
|
|
1082 |
// Cannot open file
|
|
1083 |
cout << AT_MSG << "Error, can not open file: " << m_sMakeFile << endl;
|
|
1084 |
return false;
|
|
1085 |
}
|
|
1086 |
// Check is it wrapper makefile (starts with "%:")
|
|
1087 |
in.getline( cLine, MAX_LINE_LENGTH );
|
|
1088 |
if ( cLine[0] == '%' && cLine[1] == ':' )
|
|
1089 |
{
|
|
1090 |
LOG_STRING("Found wrapper makefile");
|
|
1091 |
in.close();
|
|
1092 |
// Use ".default" makefile
|
|
1093 |
string sDefaultMakeFile = m_sMakeFile.substr( 0, m_sMakeFile.find_last_of( "." ) );
|
|
1094 |
sDefaultMakeFile.append( ".DEFAULT" );
|
|
1095 |
LOG_STRING( "using makefile :" << m_sMakeFile );
|
|
1096 |
// Does default exists. If not we need to run "wrapper make"
|
|
1097 |
if ( ! FileExists( sDefaultMakeFile.c_str() ) )
|
|
1098 |
{
|
|
1099 |
// Run the wrapper make to create "real" makefile
|
|
1100 |
string sMakeFileCmd;
|
|
1101 |
sMakeFileCmd.append("make -f \"");
|
|
1102 |
sMakeFileCmd.append( m_sMakeFile );
|
|
1103 |
sMakeFileCmd.append( "\"" );
|
|
1104 |
LOG_STRING( "using makefile :" << m_sMakeFile );
|
|
1105 |
cout << AT_MSG_SYSTEM_CALL << sMakeFileCmd << endl;
|
|
1106 |
int iRet = (int)system( sMakeFileCmd.c_str() );
|
|
1107 |
if ( iRet )
|
|
1108 |
{
|
|
1109 |
cout << MAKE_ERROR;
|
|
1110 |
return false;
|
|
1111 |
}
|
|
1112 |
}
|
|
1113 |
m_sMakeFile = sDefaultMakeFile;
|
|
1114 |
// Open new file
|
|
1115 |
in.open( m_sMakeFile.c_str(), ios_base::in );
|
|
1116 |
// Check that it's open
|
|
1117 |
if ( ! in.good() )
|
|
1118 |
{
|
|
1119 |
// Cannot open file
|
|
1120 |
cout << AT_MSG << "Error, can not open makefile: " << m_sMakeFile << endl;
|
|
1121 |
return false;
|
|
1122 |
}
|
|
1123 |
}
|
|
1124 |
in.seekg( ios_base::beg );
|
|
1125 |
|
|
1126 |
// Number of lines to read at max for basic module information.
|
|
1127 |
int iReadLineCount = 20;
|
|
1128 |
// Extension from target line. to be compared with targettype.
|
|
1129 |
string sTargetExtension;
|
|
1130 |
// Read line at a time. Loop until we find it or eof
|
|
1131 |
do {
|
|
1132 |
// Read line from file to array
|
|
1133 |
in.getline( cLine, MAX_LINE_LENGTH );
|
|
1134 |
iReadLineCount--;
|
|
1135 |
|
|
1136 |
sLine.clear();
|
|
1137 |
// Put that to string
|
|
1138 |
sLine.append( cLine );
|
|
1139 |
// Search target
|
|
1140 |
if ( sLine.find( MAKEFILE_TARGET_STRING ) != string::npos )
|
|
1141 |
{
|
|
1142 |
// Found it. Now remove other than type from line
|
|
1143 |
sLine.erase( 0, strlen( MAKEFILE_TARGET_STRING ) );
|
|
1144 |
ChangeToLower( sLine );
|
|
1145 |
sTargetExtension.clear();
|
|
1146 |
sTargetExtension = GetExtension( sLine );
|
|
1147 |
m_sTarget = RemovePathAndExt( sLine, true);
|
|
1148 |
LOG_STRING("found target: " << sLine );
|
|
1149 |
}
|
|
1150 |
// Search targettype
|
|
1151 |
else if ( sLine.find( MAKEFILE_TARGETTYPE_STRING ) != string::npos )
|
|
1152 |
{
|
|
1153 |
// Found it. Now remove other than type from line
|
|
1154 |
sLine.erase( 0, strlen( MAKEFILE_TARGETTYPE_STRING ) );
|
|
1155 |
ChangeToLower( sLine );
|
|
1156 |
m_sTargetType = sLine;
|
|
1157 |
LOG_STRING("found target type: " << m_sTargetType );
|
|
1158 |
}
|
|
1159 |
else if ( sLine.find( MAKEFILE_BASIC_TARGETTYPE_STRING ) != string::npos )
|
|
1160 |
{
|
|
1161 |
sLine.erase( 0, strlen( MAKEFILE_BASIC_TARGETTYPE_STRING ) );
|
|
1162 |
ChangeToLower( sLine );
|
|
1163 |
m_sRequestedTargetExt = sLine;
|
|
1164 |
// Compare with the extension in target line if not same use target lines if its "valid".
|
|
1165 |
if ( m_sRequestedTargetExt.compare( sTargetExtension ) != 0 && sTargetExtension.size() > 0 )
|
|
1166 |
m_sRequestedTargetExt = sTargetExtension;
|
|
1167 |
LOG_STRING("found requested target extension: " << m_sTargetType );
|
|
1168 |
}
|
|
1169 |
// Feature variant details
|
|
1170 |
else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_NAME ) != string::npos )
|
|
1171 |
{
|
|
1172 |
sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_NAME ) );
|
|
1173 |
m_sFeatureVariantName = sLine;
|
|
1174 |
LOG_STRING("found feature variant name: " << sLine );
|
|
1175 |
}
|
|
1176 |
else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_UREL_LABEL ) != string::npos )
|
|
1177 |
{
|
|
1178 |
sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_UREL_LABEL ) );
|
|
1179 |
LOG_STRING("found feature variant urel label: " << sLine );
|
|
1180 |
if ( sLine.compare("INVARIANT") != 0 )
|
|
1181 |
m_sFeatureVariantURELLabel = sLine;
|
|
1182 |
}
|
|
1183 |
else if ( sLine.find( MAKEFILE_FEATURE_VARIANT_UDEB_LABEL ) != string::npos )
|
|
1184 |
{
|
|
1185 |
sLine.erase( 0, strlen( MAKEFILE_FEATURE_VARIANT_UDEB_LABEL ) );
|
|
1186 |
LOG_STRING("found feature variant udeb label: " << sLine );
|
|
1187 |
if ( sLine.compare("INVARIANT") != 0 )
|
|
1188 |
m_sFeatureVariantUDEBLabel = sLine;
|
|
1189 |
}
|
|
1190 |
} while( in.good() && iReadLineCount > 0 );
|
|
1191 |
|
|
1192 |
// Search compile definitions
|
|
1193 |
// CWDEFS CCDEFS ARMCCDEFS
|
|
1194 |
do
|
|
1195 |
{
|
|
1196 |
in.getline( cLine, MAX_LINE_LENGTH );
|
|
1197 |
sLine.clear();
|
|
1198 |
sLine.append( cLine );
|
|
1199 |
if ( sLine.substr( 0 , 6 ).compare( string("CWDEFS") ) == 0
|
|
1200 |
|| sLine.substr( 0 , 6 ).compare( string("CCDEFS") ) == 0 )
|
|
1201 |
{
|
|
1202 |
sLine.erase( 0, 8 );
|
|
1203 |
m_sCompileDefinitions = sLine;
|
|
1204 |
break;
|
|
1205 |
}
|
|
1206 |
else if( sLine.substr( 0 , 9 ).compare( string("ARMCCDEFS") ) == 0 )
|
|
1207 |
{
|
|
1208 |
sLine.erase( 0, 11 );
|
|
1209 |
m_sCompileDefinitions = sLine;
|
|
1210 |
break;
|
|
1211 |
}
|
|
1212 |
} while( in.good() );
|
|
1213 |
// Move reading back to start if we could not find compile flags.
|
|
1214 |
in.seekg( ios_base::beg );
|
|
1215 |
|
|
1216 |
// Search listing information (modules source files).
|
|
1217 |
int iFindItem = 1; //1 = Source, 2 = LISTINGUDEB/UREL, 3 = lst file
|
|
1218 |
string sCdefs;
|
|
1219 |
string sSource;
|
|
1220 |
string sLst;
|
|
1221 |
do
|
|
1222 |
{
|
|
1223 |
in.getline( cLine, MAX_LINE_LENGTH );
|
|
1224 |
sLine.clear();
|
|
1225 |
sLine.append( cLine );
|
|
1226 |
|
|
1227 |
switch( iFindItem )
|
|
1228 |
{
|
|
1229 |
case 1:
|
|
1230 |
if( sLine.find( "# Source " ) != string::npos )
|
|
1231 |
{
|
|
1232 |
iFindItem = 2;
|
|
1233 |
// Remove text "# Source "
|
|
1234 |
sLine.erase( 0, 9 );
|
|
1235 |
sSource = sLine;
|
|
1236 |
}
|
|
1237 |
break;
|
|
1238 |
case 2:
|
|
1239 |
if( IsUDEB() )
|
|
1240 |
{
|
|
1241 |
if( sLine.find( "LISTINGUDEB" ) != string::npos )
|
|
1242 |
{
|
|
1243 |
iFindItem = 3;
|
|
1244 |
}
|
|
1245 |
}
|
|
1246 |
else
|
|
1247 |
{
|
|
1248 |
if( sLine.find( "LISTINGUREL" ) != string::npos )
|
|
1249 |
{
|
|
1250 |
iFindItem = 3;
|
|
1251 |
}
|
|
1252 |
}
|
|
1253 |
break;
|
|
1254 |
case 3:
|
|
1255 |
if( sLine.find( "perl -S ecopyfile.pl" ) != string::npos )
|
|
1256 |
{
|
|
1257 |
// Save lst file to list
|
|
1258 |
sLine.erase( 0, ( sLine.find_first_of( "\\" ) ) );
|
|
1259 |
// remove last char if '"'
|
|
1260 |
if ( sLine.at( sLine.size()-1 ) == '"' )
|
|
1261 |
sLine.erase( sLine.size()-1, sLine.size() );
|
|
1262 |
sLst = sLine;
|
|
1263 |
AddSource( sSource, sLst );
|
|
1264 |
iFindItem = 1;
|
|
1265 |
sSource.clear(); sLst.clear();
|
|
1266 |
|
|
1267 |
}
|
|
1268 |
break;
|
|
1269 |
}
|
|
1270 |
}
|
|
1271 |
while( in.good() );
|
|
1272 |
// close and return
|
|
1273 |
in.close();
|
|
1274 |
return true;
|
|
1275 |
}
|
|
1276 |
|
|
1277 |
// ----------------------------------------------------------------------------
|
|
1278 |
// Get & Sets
|
|
1279 |
// ----------------------------------------------------------------------------
|
|
1280 |
string CATModule2::GetErrors() const
|
|
1281 |
{
|
|
1282 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetErrors");
|
|
1283 |
return m_sErrors;
|
|
1284 |
}
|
|
1285 |
|
|
1286 |
string CATModule2::GetS60FileName() const
|
|
1287 |
{
|
|
1288 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetS60FileName");
|
|
1289 |
if ( m_sS60FileName.empty() )
|
|
1290 |
{
|
|
1291 |
string sGeneratedDatName = m_sTarget;
|
|
1292 |
sGeneratedDatName.append(".");
|
|
1293 |
sGeneratedDatName.append( m_sTargetType );
|
|
1294 |
sGeneratedDatName.append(".dat");
|
|
1295 |
return sGeneratedDatName;
|
|
1296 |
}
|
|
1297 |
return m_sS60FileName;
|
|
1298 |
}
|
|
1299 |
|
|
1300 |
string CATModule2::GetLstNameOfSource(string sSource) const
|
|
1301 |
{
|
|
1302 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetLstNameOfSource");
|
|
1303 |
// Find . before xtension
|
|
1304 |
size_t iSpot = sSource.find_last_of( "." );
|
|
1305 |
// Get sub string to there
|
|
1306 |
string sLst = sSource.substr(0, iSpot+1);
|
|
1307 |
if ( m_sVariantPlatform.compare( "winscw" ) != 0 )
|
|
1308 |
{
|
|
1309 |
// Add variant platform (i.e. armv5)
|
|
1310 |
sLst.append( m_sVariantPlatform );
|
|
1311 |
sLst.append( "." );
|
|
1312 |
// Add variant type (i.e. build type liek urel)
|
|
1313 |
sLst.append( m_sVariantType );
|
|
1314 |
sLst.append( "." );
|
|
1315 |
// Add target binary name
|
|
1316 |
sLst.append( m_sTarget );
|
|
1317 |
sLst.append( "." );
|
|
1318 |
// Add target requested binary extension
|
|
1319 |
sLst.append( m_sRequestedTargetExt );
|
|
1320 |
sLst.append( "." );
|
|
1321 |
// Add lst extension
|
|
1322 |
sLst.append( "lst" );
|
|
1323 |
}
|
|
1324 |
else
|
|
1325 |
{
|
|
1326 |
sLst.append( "WINSCW.lst" );
|
|
1327 |
}
|
|
1328 |
return sLst;
|
|
1329 |
}
|
|
1330 |
|
|
1331 |
bool CATModule2::IsPlatformArmv5() const
|
|
1332 |
{
|
|
1333 |
LOG_LOW_FUNC_ENTRY("CATModule2::IsPlatformArmv5");
|
|
1334 |
if ( _stricmp( m_sVariantPlatform.c_str(), "armv5" ) == 0 )
|
|
1335 |
return true;
|
|
1336 |
return false;
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
string CATModule2::GetMapFile() const
|
|
1340 |
{
|
|
1341 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetMapFile");
|
|
1342 |
// Map file with path using variables
|
|
1343 |
string sMapFile( m_sReleasePath );
|
|
1344 |
if ( ! sMapFile.empty() )
|
|
1345 |
sMapFile.append( "\\" );
|
|
1346 |
sMapFile.append( m_sFullVariantPath );
|
|
1347 |
if ( ! m_sFullVariantPath.empty() )
|
|
1348 |
sMapFile.append( "\\" );
|
|
1349 |
sMapFile.append( m_sTarget );
|
|
1350 |
sMapFile.append( "." );
|
|
1351 |
// Possible feature variant. Note debug might not be defined
|
|
1352 |
// when release has got one.
|
|
1353 |
if ( IsUDEB() && !m_sFeatureVariantUDEBLabel.empty() )
|
|
1354 |
{
|
|
1355 |
sMapFile.append( m_sFeatureVariantUDEBLabel );
|
|
1356 |
sMapFile.append( "." );
|
|
1357 |
}
|
|
1358 |
|
|
1359 |
if ( !IsUDEB() && !m_sFeatureVariantURELLabel.empty() )
|
|
1360 |
{
|
|
1361 |
sMapFile.append( m_sFeatureVariantURELLabel );
|
|
1362 |
sMapFile.append( "." );
|
|
1363 |
}
|
|
1364 |
sMapFile.append( m_sRequestedTargetExt );
|
|
1365 |
sMapFile.append( ".map" );
|
|
1366 |
return sMapFile;
|
|
1367 |
}
|
|
1368 |
|
|
1369 |
string CATModule2::GetSymbolFile() const
|
|
1370 |
{
|
|
1371 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetSymbolFile");
|
|
1372 |
// Symbol file with path using variables
|
|
1373 |
string sSymbolFile( m_sReleasePath );
|
|
1374 |
sSymbolFile.append( "\\" );
|
|
1375 |
sSymbolFile.append( m_sFullVariantPath );
|
|
1376 |
sSymbolFile.append( "\\" );
|
|
1377 |
sSymbolFile.append( m_sTarget );
|
|
1378 |
sSymbolFile.append( "." );
|
|
1379 |
// Possible feature variant.
|
|
1380 |
if ( ! m_sFeatureVariantUDEBLabel.empty() || ! m_sFeatureVariantURELLabel.empty() )
|
|
1381 |
{
|
|
1382 |
if ( IsUDEB() )
|
|
1383 |
sSymbolFile.append( m_sFeatureVariantUDEBLabel );
|
|
1384 |
else
|
|
1385 |
sSymbolFile.append( m_sFeatureVariantURELLabel );
|
|
1386 |
sSymbolFile.append( "." );
|
|
1387 |
}
|
|
1388 |
|
|
1389 |
if ( m_eBuildSystem == CATProject::SBS_V1 )
|
|
1390 |
{
|
|
1391 |
sSymbolFile.append( "sym" );
|
|
1392 |
return sSymbolFile;
|
|
1393 |
}
|
|
1394 |
sSymbolFile.append( m_sRequestedTargetExt );
|
|
1395 |
sSymbolFile.append( ".sym" );
|
|
1396 |
return sSymbolFile;
|
|
1397 |
}
|
|
1398 |
|
|
1399 |
string CATModule2::GetBinaryFile() const
|
|
1400 |
{
|
|
1401 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetBinaryFile");
|
|
1402 |
// Binary file with path using variables
|
|
1403 |
string sBinaryFile( m_sReleasePath );
|
|
1404 |
if ( ! sBinaryFile.empty() )
|
|
1405 |
sBinaryFile.append( "\\" );
|
|
1406 |
sBinaryFile.append( m_sFullVariantPath );
|
|
1407 |
if ( ! m_sFullVariantPath.empty() )
|
|
1408 |
sBinaryFile.append( "\\" );
|
|
1409 |
sBinaryFile.append( m_sTarget );
|
|
1410 |
sBinaryFile.append( "." );
|
|
1411 |
// Possible feature variant.
|
|
1412 |
if ( ! m_sFeatureVariantUDEBLabel.empty() || ! m_sFeatureVariantURELLabel.empty() )
|
|
1413 |
{
|
|
1414 |
if ( IsUDEB() )
|
|
1415 |
sBinaryFile.append( m_sFeatureVariantUDEBLabel );
|
|
1416 |
else
|
|
1417 |
sBinaryFile.append( m_sFeatureVariantURELLabel );
|
|
1418 |
sBinaryFile.append( "." );
|
|
1419 |
}
|
|
1420 |
sBinaryFile.append( m_sRequestedTargetExt );
|
|
1421 |
return sBinaryFile;
|
|
1422 |
}
|
|
1423 |
|
|
1424 |
bool CATModule2::SetMmpFile(const string& sMmpFile)
|
|
1425 |
{
|
|
1426 |
LOG_FUNC_ENTRY("CATModule2::SetMmpFile");
|
|
1427 |
// Set mmp file
|
|
1428 |
m_Mmp.m_sMmpFile = sMmpFile;
|
|
1429 |
// Change to lower
|
|
1430 |
ChangeToLower( m_Mmp.m_sMmpFile );
|
|
1431 |
// Convert
|
|
1432 |
ConvertUnixPathToWin( m_Mmp.m_sMmpFile );
|
|
1433 |
// Set the temporary path.
|
|
1434 |
m_sTempPath.clear();
|
|
1435 |
m_sTempPath = CreateTempPath( m_Mmp.m_sMmpFile );
|
|
1436 |
return true;
|
|
1437 |
}
|
|
1438 |
|
|
1439 |
bool CATModule2::CreateTemporaryDirectory()
|
|
1440 |
{
|
|
1441 |
LOG_FUNC_ENTRY("CATModule2::CreateTemporaryDirectory");
|
|
1442 |
if ( m_sTempPath.empty() )
|
|
1443 |
{
|
|
1444 |
LOG_STRING("Temporary path is not set.");
|
|
1445 |
return false;
|
|
1446 |
}
|
|
1447 |
// Create temp dir if not exists
|
|
1448 |
if ( ! DirectoryExists( m_sTempPath.c_str() ) )
|
|
1449 |
{
|
|
1450 |
if ( !CreateDirectory( m_sTempPath.c_str(), NULL ) )
|
|
1451 |
{
|
|
1452 |
cout << AT_MSG << "Error, can not create directory: "
|
|
1453 |
<< m_sTempPath << endl;
|
|
1454 |
return false;
|
|
1455 |
}
|
|
1456 |
cout << AT_MSG << "Directory created: " << m_sTempPath << endl;
|
|
1457 |
}
|
|
1458 |
return true;
|
|
1459 |
}
|
|
1460 |
|
|
1461 |
void CATModule2::SetMakeFile( const string& sMakeFile )
|
|
1462 |
{
|
|
1463 |
LOG_FUNC_ENTRY("CATModule2::SetMakeFile");
|
|
1464 |
m_sMakeFile = sMakeFile;
|
|
1465 |
}
|
|
1466 |
string CATModule2::GetMakeFile() const
|
|
1467 |
{
|
|
1468 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetMakeFile");
|
|
1469 |
return m_sMakeFile;
|
|
1470 |
}
|
|
1471 |
string CATModule2::GetMmpFile() const
|
|
1472 |
{
|
|
1473 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetMmpFile");
|
|
1474 |
return m_Mmp.m_sMmpFile;
|
|
1475 |
}
|
|
1476 |
string CATModule2::GetTempPath() const
|
|
1477 |
{
|
|
1478 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetTempPath");
|
|
1479 |
return m_sTempPath;
|
|
1480 |
}
|
|
1481 |
void CATModule2::SetTarget(const string& sTarget)
|
|
1482 |
{
|
|
1483 |
LOG_FUNC_ENTRY("CATModule2::SetTarget");
|
|
1484 |
m_sTarget = sTarget;
|
|
1485 |
ChangeToLower( m_sTarget );
|
|
1486 |
}
|
|
1487 |
string CATModule2::GetTarget() const
|
|
1488 |
{
|
|
1489 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetTarget");
|
|
1490 |
return m_sTarget;
|
|
1491 |
}
|
|
1492 |
string CATModule2::GetBinaryName() const
|
|
1493 |
{
|
|
1494 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetBinaryName");
|
|
1495 |
string sBinaryName;
|
|
1496 |
sBinaryName.append( m_sTarget );
|
|
1497 |
sBinaryName.append( "." );
|
|
1498 |
sBinaryName.append( m_sRequestedTargetExt );
|
|
1499 |
return sBinaryName;
|
|
1500 |
}
|
|
1501 |
|
|
1502 |
void CATModule2::SetTargetType(const string& sTargetType)
|
|
1503 |
{
|
|
1504 |
LOG_FUNC_ENTRY("CATModule2::SetTargetType");
|
|
1505 |
m_sTargetType = sTargetType;
|
|
1506 |
ChangeToLower( m_sTargetType );
|
|
1507 |
}
|
|
1508 |
string CATModule2::GetTargetType() const
|
|
1509 |
{
|
|
1510 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetTargetType");
|
|
1511 |
return m_sTargetType;
|
|
1512 |
}
|
|
1513 |
void CATModule2::SetRequestedTargetExt( const string& sRequestedTargetExt )
|
|
1514 |
{
|
|
1515 |
LOG_FUNC_ENTRY("CATModule2::SetRequestedTargetExt");
|
|
1516 |
m_sRequestedTargetExt = sRequestedTargetExt;
|
|
1517 |
ChangeToLower( m_sRequestedTargetExt );
|
|
1518 |
}
|
|
1519 |
|
|
1520 |
string CATModule2::GetRequestedTargetExt() const
|
|
1521 |
{
|
|
1522 |
LOG_LOW_FUNC_ENTRY("CATmodule2::GetRequestedTargetExt");
|
|
1523 |
return m_sRequestedTargetExt;
|
|
1524 |
}
|
|
1525 |
|
|
1526 |
void CATModule2::SetVariantPlatform(const string& sVariantPlatform)
|
|
1527 |
{
|
|
1528 |
LOG_FUNC_ENTRY("CATModule2::SetVariantPlatform");
|
|
1529 |
m_sVariantPlatform = sVariantPlatform;
|
|
1530 |
ChangeToLower( m_sVariantPlatform );
|
|
1531 |
}
|
|
1532 |
string CATModule2::GetVariantPlatform() const
|
|
1533 |
{
|
|
1534 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetVariantPlatform");
|
|
1535 |
return m_sVariantPlatform;
|
|
1536 |
}
|
|
1537 |
void CATModule2::SetVariantType(const string& sVariantType)
|
|
1538 |
{
|
|
1539 |
LOG_FUNC_ENTRY("CATModule2::SetVariantType");
|
|
1540 |
m_sVariantType = sVariantType;
|
|
1541 |
ChangeToLower( m_sVariantType );
|
|
1542 |
}
|
|
1543 |
string CATModule2::GetVariantType() const
|
|
1544 |
{
|
|
1545 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetVariantType");
|
|
1546 |
return m_sVariantType;
|
|
1547 |
}
|
|
1548 |
void CATModule2::SetFeatureVariant(const string& sFeatureVariant)
|
|
1549 |
{
|
|
1550 |
LOG_FUNC_ENTRY("CATModule2::SetFeatureVariant");
|
|
1551 |
m_sFeatureVariant = sFeatureVariant;
|
|
1552 |
ChangeToLower( m_sFeatureVariant );
|
|
1553 |
}
|
|
1554 |
string CATModule2::GetFeatureVariant() const
|
|
1555 |
{
|
|
1556 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetFeatureVariant");
|
|
1557 |
return m_sFeatureVariant;
|
|
1558 |
}
|
|
1559 |
void CATModule2::SetFeatureVariantName(const string& sFeatureVariantName)
|
|
1560 |
{
|
|
1561 |
LOG_FUNC_ENTRY("CATModule2::SetFeatureVariantName");
|
|
1562 |
m_sFeatureVariantName = sFeatureVariantName;
|
|
1563 |
ChangeToLower( m_sFeatureVariantName );
|
|
1564 |
}
|
|
1565 |
string CATModule2::GetFeatureVariantName() const
|
|
1566 |
{
|
|
1567 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetFeatureVariantName");
|
|
1568 |
return m_sFeatureVariantName;
|
|
1569 |
}
|
|
1570 |
void CATModule2::SetReleasePath(const string& sReleasePath)
|
|
1571 |
{
|
|
1572 |
LOG_FUNC_ENTRY("CATModule2::SetReleasePath");
|
|
1573 |
m_sReleasePath = sReleasePath;
|
|
1574 |
ChangeToLower( m_sReleasePath );
|
|
1575 |
ConvertUnixPathToWin( m_sReleasePath );
|
|
1576 |
|
|
1577 |
}
|
|
1578 |
string CATModule2::GetReleasePath() const
|
|
1579 |
{
|
|
1580 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetReleasePath");
|
|
1581 |
return m_sReleasePath;
|
|
1582 |
}
|
|
1583 |
void CATModule2::SetFullVariantPath(const string& sFullVariantPath)
|
|
1584 |
{
|
|
1585 |
LOG_FUNC_ENTRY("CATModule2::SetFullVariantPath");
|
|
1586 |
m_sFullVariantPath = sFullVariantPath;
|
|
1587 |
ChangeToLower( m_sFullVariantPath );
|
|
1588 |
ConvertUnixPathToWin( m_sFullVariantPath );
|
|
1589 |
}
|
|
1590 |
string CATModule2::GetFullVariantPath() const
|
|
1591 |
{
|
|
1592 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetFullVariantPath");
|
|
1593 |
return m_sFullVariantPath;
|
|
1594 |
}
|
|
1595 |
string CATModule2::GetUniqueId() const
|
|
1596 |
{
|
|
1597 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetUniqueId");
|
|
1598 |
return FilterString( m_sTarget );
|
|
1599 |
}
|
|
1600 |
void CATModule2::SetBuildSystem( int eBuildSystem )
|
|
1601 |
{
|
|
1602 |
LOG_FUNC_ENTRY("CATModule2::SetBuildSystem");
|
|
1603 |
m_eBuildSystem = eBuildSystem;
|
|
1604 |
}
|
|
1605 |
|
|
1606 |
int CATModule2::GetBuildSystem() const
|
|
1607 |
{
|
|
1608 |
LOG_LOW_FUNC_ENTRY("CATModule2::GetBuildSystem");
|
|
1609 |
return m_eBuildSystem;
|
|
1610 |
}
|
|
1611 |
|
|
1612 |
void CATModule2::SetCompileDefinitions( const string& sCompileDefinitions )
|
|
1613 |
{
|
|
1614 |
LOG_LOW_FUNC_ENTRY( "CATModule2::SetCompileDefinitions" );
|
|
1615 |
m_sCompileDefinitions = sCompileDefinitions;
|
|
1616 |
}
|
|
1617 |
|
|
1618 |
string CATModule2::GetCompileDefinitions() const
|
|
1619 |
{
|
|
1620 |
LOG_LOW_FUNC_ENTRY( "CATModule2::GetCompileDefinitions" );
|
|
1621 |
return m_sCompileDefinitions;
|
|
1622 |
}
|
|
1623 |
|
|
1624 |
void CATModule2::SetCompileInfoText( string sCompileInfoText )
|
|
1625 |
{
|
|
1626 |
LOG_LOW_FUNC_ENTRY( "CATModule2::SetCompileInfoText" );
|
|
1627 |
m_sCompileInfoText = sCompileInfoText;
|
|
1628 |
}
|
|
1629 |
string CATModule2::GetCompileInfoText() const
|
|
1630 |
{
|
|
1631 |
LOG_LOW_FUNC_ENTRY( "CATModule2::GetCompileInfoText" );
|
|
1632 |
return m_sCompileInfoText;
|
|
1633 |
}
|
|
1634 |
//EOF
|