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 |
#ifndef __CATMODULE2_H__
|
|
20 |
#define __CATMODULE2_H__
|
|
21 |
|
|
22 |
// Includes.
|
|
23 |
#include "ATCommonDefines.h"
|
|
24 |
#include "CATBase.h"
|
|
25 |
#include "CATMmp.h"
|
|
26 |
|
|
27 |
// Forward declarations.
|
|
28 |
class CATMemoryAddress;
|
|
29 |
class IAddressToLine;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* CATModule2 represents a module/component (single binary) in project.
|
|
33 |
* CATProject contains a collection of these.
|
|
34 |
*/
|
|
35 |
class CATModule2 : public CATBase
|
|
36 |
{
|
|
37 |
|
|
38 |
public:
|
|
39 |
/**
|
|
40 |
* Constructor.
|
|
41 |
*/
|
|
42 |
CATModule2(void);
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Destructor.
|
|
46 |
*/
|
|
47 |
~CATModule2(void);
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Read modules attributes from SBS v.1 makefile.
|
|
51 |
* Also copies makefile to temporary directory if successful.
|
|
52 |
*/
|
|
53 |
bool ReadMakeFile();
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Read modules attributes from SBS v.1 makefile.
|
|
57 |
* From make file which is in modules temporary directory.
|
|
58 |
*/
|
|
59 |
bool ReadMakeFileFromTemp();
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Add sources using line where source files separated by spaces.
|
|
63 |
* @param sSourceLine.
|
|
64 |
*/
|
|
65 |
void AddSources(string& sSourceLine);
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Add sources by giving source file and its corresponding listing file.
|
|
69 |
* @param sSourceFile
|
|
70 |
* @param sLstFile
|
|
71 |
*/
|
|
72 |
void AddSource(const string& sSourceFile, const string& sLstFile);
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Create AT temporary cpp file for module.
|
|
76 |
* @param sS60FileName.
|
|
77 |
* @param eLoggingMode.
|
|
78 |
* @param eBuildType.
|
|
79 |
* @param iAllocCallStackSize.
|
|
80 |
* @param iFreeCallStackSize.
|
|
81 |
* @return true if successful.
|
|
82 |
*/
|
|
83 |
bool CreateTempCpp(const string& sS60FileName
|
|
84 |
, int eLoggingMode
|
|
85 |
, int eBuildType
|
|
86 |
, int iAllocCallStackSize
|
|
87 |
, int iFreeCallStackSize );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Add AT changes to modules mmp file.
|
|
91 |
* @return true if successful.
|
|
92 |
*/
|
|
93 |
bool ModifyMmp();
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Restore any changes made to modules mmp file.
|
|
97 |
* @return true if successful.
|
|
98 |
*/
|
|
99 |
bool RestoreMmp();
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Verify tha mmp does not contain AnalyzeTool made changes.
|
|
103 |
* If it does contain them will remove them manually or using backup.
|
|
104 |
* @return true if successful.
|
|
105 |
*/
|
|
106 |
bool VerifyAndRecoverMmp();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Copy modules releasables to its temporary dir.
|
|
110 |
* This includes map & lst files.
|
|
111 |
* @return true if successful.
|
|
112 |
*/
|
|
113 |
bool CopyReleasables();
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Copy modules listing files to given directory.
|
|
117 |
* After copy they will be deleted.
|
|
118 |
* @param sDir target directory.
|
|
119 |
* @return true if successful.
|
|
120 |
*/
|
|
121 |
bool CopyLstFilesToDir( const string& sDir );
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Delete modules lst files from their source
|
|
125 |
* directories.
|
|
126 |
* @return true if succesfful.
|
|
127 |
*/
|
|
128 |
bool DeleteLstFilesFromSrc();
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Clean modules temporary directory of files,
|
|
132 |
* not defined in UNDELETE list.
|
|
133 |
* @return true if successful
|
|
134 |
*/
|
|
135 |
bool CleanTemporaryDir();
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Delete modules temporary directory.
|
|
139 |
* @return true if successful.
|
|
140 |
*/
|
|
141 |
bool DeleteTemporaryDir();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Locate codeline of given memory address.
|
|
145 |
* Given address must be calculated to correspond map file addresses.
|
|
146 |
* @param pMemoryAddress object where to store results.
|
|
147 |
* @return true if successful.
|
|
148 |
*/
|
|
149 |
bool AddressToLine(CATMemoryAddress* pMemoryAddress);
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Check does modules symbol file(s) exist.
|
|
153 |
* @return true if it exists.
|
|
154 |
*/
|
|
155 |
bool SymbolFileExist( void );
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Check does modules map file(s) exists.
|
|
159 |
* @return true if it exists.
|
|
160 |
*/
|
|
161 |
bool MapFileExist( void );
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Check does modules binary file(s) exist.
|
|
165 |
* @return true if it exists.
|
|
166 |
*/
|
|
167 |
bool BinaryFileExist( void );
|
|
168 |
|
|
169 |
#ifndef MODULE_TEST
|
|
170 |
private:
|
|
171 |
#endif
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Read modules attributes from make file.
|
|
175 |
*/
|
|
176 |
bool ReadMakeFilePrivate();
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Locate codeline of given memory address (winscw platform).
|
|
180 |
* Given address must be calculated to correspond map file addresses.
|
|
181 |
* @param pMemoryAddress object where to store results.
|
|
182 |
* @return true if successful.
|
|
183 |
*/
|
|
184 |
bool AddressToLineWinscw(CATMemoryAddress* pMemoryAddress );
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Locate codeline of given memory address (armv5 platform).
|
|
188 |
* Given address must be calculated to correspond map file addresses.
|
|
189 |
* @param pMemoryAddress object where to store results.
|
|
190 |
* @return true if successful.
|
|
191 |
*/
|
|
192 |
bool AddressToLineArmv5(CATMemoryAddress* pMemoryAddress );
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Locate codeline of given memory address.
|
|
196 |
* Given address must be calculated to correspond map file addresses.
|
|
197 |
* @param pMemoryAddress object where to store results.
|
|
198 |
* @return true if successful.
|
|
199 |
*/
|
|
200 |
bool AddressToLineAddr2lineExe( CATMemoryAddress* pMemoryAddress );
|
|
201 |
|
|
202 |
/**
|
|
203 |
* Search map file data (symbols) using given address.
|
|
204 |
* @param iAddress memory address.
|
|
205 |
* @return index of the symbol or -1 if not found.
|
|
206 |
*/
|
|
207 |
int GetSymbolIndexUsingAddress(unsigned long iAddress) const;
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Search listing files data using the given symbol name.
|
|
211 |
* @param sSymbolName symbols name to find.
|
|
212 |
* @return index of the found lst data or -1 if not found.
|
|
213 |
*/
|
|
214 |
int GetLineInFileIndexUsingSymbolName(const string& sSymbolName) const;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Search the exact code line from given file.
|
|
218 |
* @param sFileName listing file to search from.
|
|
219 |
* @param iLine functions line number.
|
|
220 |
* @param iFromFuncAddress how many bytes from functions start.
|
|
221 |
* @return line number or -1 if not found.
|
|
222 |
*/
|
|
223 |
int FindLeakCodeLine( string& sFileName, int iLine, unsigned long iFromFuncAddress ) const;
|
|
224 |
|
|
225 |
public:
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Set used build system (CATProject::BUILD_SYSTEM).
|
|
229 |
* @param eBuildSystem.
|
|
230 |
*/
|
|
231 |
void SetBuildSystem( int eBuildSystem );
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Get defined build system.
|
|
235 |
* @return int CATProject::BUILD_SYSTEM
|
|
236 |
*/
|
|
237 |
int GetBuildSystem( void ) const ;
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Set SBS v.1 makefile.
|
|
241 |
* @param sMakeFile
|
|
242 |
*/
|
|
243 |
void SetMakeFile( const string& sMakeFile );
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Get SBS v.1 makefile.
|
|
247 |
* @return string makefile.
|
|
248 |
*/
|
|
249 |
string GetMakeFile( void ) const;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Initialize module ready for locating code lines.
|
|
253 |
* with memory addresses (reads map and listing files).
|
|
254 |
* return true if successful.
|
|
255 |
*/
|
|
256 |
bool InitializeAddressToLine();
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Set modules mmp file.
|
|
260 |
* This also creates temporary dir if it is missing.
|
|
261 |
* @return true if successful.
|
|
262 |
*/
|
|
263 |
bool SetMmpFile(const string& sMmpFile);
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Create modules own temporary directory.
|
|
267 |
* @return true if successful.
|
|
268 |
*/
|
|
269 |
bool CreateTemporaryDirectory();
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Get modules mmp file.
|
|
273 |
* @return mmp file.
|
|
274 |
*/
|
|
275 |
string GetMmpFile() const;
|
|
276 |
|
|
277 |
/**
|
|
278 |
* Get modules atool_temp directory path.
|
|
279 |
* @return atool_temp directory path.
|
|
280 |
*/
|
|
281 |
string GetTempPath() const;
|
|
282 |
|
|
283 |
/**
|
|
284 |
* Get S60 logging file name.
|
|
285 |
* @return s60 logging file name.
|
|
286 |
*/
|
|
287 |
string GetS60FileName() const;
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Set target binary name.
|
|
291 |
* @param sTarget binary file name.
|
|
292 |
*/
|
|
293 |
void SetTarget(const string& sTarget);
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Get target binary name.
|
|
297 |
* @return modules binary file name.
|
|
298 |
*/
|
|
299 |
string GetTarget() const;
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Set binary target type.
|
|
303 |
* @param sTargetType binary target type.
|
|
304 |
*/
|
|
305 |
void SetTargetType(const string& sTargetType);
|
|
306 |
|
|
307 |
/**
|
|
308 |
* Get binary target type.
|
|
309 |
* @return binary target type.
|
|
310 |
*/
|
|
311 |
string GetTargetType() const;
|
|
312 |
|
|
313 |
/**
|
|
314 |
* Set requested binary target file extension.
|
|
315 |
* @param sRequestedTargetExt binary target file extension.
|
|
316 |
*/
|
|
317 |
void SetRequestedTargetExt( const string& sRequestedTargetExt );
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Get requested binary target file extension.
|
|
321 |
* @return binary target file extension.
|
|
322 |
*/
|
|
323 |
string GetRequestedTargetExt() const;
|
|
324 |
|
|
325 |
/**
|
|
326 |
* Get full name of modules binary.
|
|
327 |
* @return modules binary files full name.
|
|
328 |
*/
|
|
329 |
string GetBinaryName() const;
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Set variant platform.
|
|
333 |
* @param sVariantPlatform variant platform.
|
|
334 |
*/
|
|
335 |
void SetVariantPlatform(const string& sVariantPlatform);
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Get variant platform.
|
|
339 |
* @return variant platform.
|
|
340 |
*/
|
|
341 |
string GetVariantPlatform() const;
|
|
342 |
|
|
343 |
/**
|
|
344 |
* Set variant type.
|
|
345 |
* @param sVariantType variant type.
|
|
346 |
*/
|
|
347 |
void SetVariantType(const string& sVariantType);
|
|
348 |
|
|
349 |
/**
|
|
350 |
* Get variant type.
|
|
351 |
* @return variant type.
|
|
352 |
*/
|
|
353 |
string GetVariantType() const;
|
|
354 |
|
|
355 |
/**
|
|
356 |
* Set feature variant.
|
|
357 |
* @param sFeatureVariant feature variant.
|
|
358 |
*/
|
|
359 |
void SetFeatureVariant(const string& sFeatureVariant);
|
|
360 |
|
|
361 |
/**
|
|
362 |
* Get feature variant.
|
|
363 |
* @return feature variant.
|
|
364 |
*/
|
|
365 |
string GetFeatureVariant() const;
|
|
366 |
|
|
367 |
/**
|
|
368 |
* Set feature variant name.
|
|
369 |
* @param sFeatureVariantName feature variant name.
|
|
370 |
*/
|
|
371 |
void SetFeatureVariantName(const string& sFeatureVariantName);
|
|
372 |
|
|
373 |
/**
|
|
374 |
* Get feature variant name.
|
|
375 |
* @return feature variant name.
|
|
376 |
*/
|
|
377 |
string GetFeatureVariantName() const;
|
|
378 |
|
|
379 |
/**
|
|
380 |
* Set release path.
|
|
381 |
* @param sReleasePath release path.
|
|
382 |
*/
|
|
383 |
void SetReleasePath(const string& sReleasePath);
|
|
384 |
|
|
385 |
/**
|
|
386 |
* Get release path.
|
|
387 |
* @return release path.
|
|
388 |
*/
|
|
389 |
string GetReleasePath() const;
|
|
390 |
|
|
391 |
/**
|
|
392 |
* Set full variant path.
|
|
393 |
* @param sFullVariantPath full variant path.
|
|
394 |
*/
|
|
395 |
void SetFullVariantPath(const string& sFullVariantPath);
|
|
396 |
|
|
397 |
/**
|
|
398 |
* Get full variant path.
|
|
399 |
* @return full variant path.
|
|
400 |
*/
|
|
401 |
string GetFullVariantPath() const;
|
|
402 |
|
|
403 |
/**
|
|
404 |
* Set compile definition(s) of the module.
|
|
405 |
* @param sCompileDefinitions
|
|
406 |
*/
|
|
407 |
void SetCompileDefinitions( const string& sCompileDefinitions );
|
|
408 |
|
|
409 |
/**
|
|
410 |
* Get compile definition(s) of the module.
|
|
411 |
* @return compile definition(s).
|
|
412 |
*/
|
|
413 |
string GetCompileDefinitions() const;
|
|
414 |
|
|
415 |
/**
|
|
416 |
* Is modules target type udeb?
|
|
417 |
* @return true if modules target type is udeb.
|
|
418 |
*/
|
|
419 |
bool IsUDEB() const;
|
|
420 |
|
|
421 |
/**
|
|
422 |
* Is module build successfully?
|
|
423 |
* This includes check of listing and map files from temporary directory.
|
|
424 |
* @return true if module build successfully.
|
|
425 |
*/
|
|
426 |
bool IsMakeSuccessfull();
|
|
427 |
|
|
428 |
/**
|
|
429 |
* Get error string. This includes possible erros what are generated when
|
|
430 |
* IsMakeSuccesfull is called.
|
|
431 |
* @return error string.
|
|
432 |
*/
|
|
433 |
string GetErrors() const;
|
|
434 |
|
|
435 |
/**
|
|
436 |
* Create build complete file to modules temporary directory.
|
|
437 |
* @return true if build complete file created successfully.
|
|
438 |
*/
|
|
439 |
bool CreateBuildCompleteFile( void );
|
|
440 |
|
|
441 |
/**
|
|
442 |
* Read map file (armv5 platform).
|
|
443 |
* @return true if map file read successfully.
|
|
444 |
*/
|
|
445 |
bool ReadMapFileArmv5();
|
|
446 |
|
|
447 |
/**
|
|
448 |
* Set compile info text
|
|
449 |
* @param sCompileInfoText
|
|
450 |
*/
|
|
451 |
void SetCompileInfoText( string sCompileInfoText );
|
|
452 |
|
|
453 |
/**
|
|
454 |
* Get compile info text
|
|
455 |
* @return compile info text
|
|
456 |
*/
|
|
457 |
string GetCompileInfoText() const;
|
|
458 |
|
|
459 |
#ifndef MODULE_TEST
|
|
460 |
private:
|
|
461 |
#endif
|
|
462 |
|
|
463 |
/**
|
|
464 |
* Struct for saving source information
|
|
465 |
* sCpp is source file.
|
|
466 |
* sLst sources corresponding lst file.
|
|
467 |
* bStatic true if source information from static library.
|
|
468 |
*/
|
|
469 |
struct SOURCE
|
|
470 |
{
|
|
471 |
bool bStatic;
|
|
472 |
string sCpp;
|
|
473 |
string sLst;
|
|
474 |
SOURCE() : bStatic(false), sCpp(""), sLst("") {}
|
|
475 |
};
|
|
476 |
|
|
477 |
// Build system
|
|
478 |
int m_eBuildSystem;
|
|
479 |
// Sbs v.1 makefile
|
|
480 |
string m_sMakeFile;
|
|
481 |
// Mmp file.
|
|
482 |
CATMmp m_Mmp;
|
|
483 |
// Temporary directory with path.
|
|
484 |
string m_sTempPath;
|
|
485 |
// Target.
|
|
486 |
string m_sTarget;
|
|
487 |
// Target type.
|
|
488 |
string m_sTargetType;
|
|
489 |
// True target extension.
|
|
490 |
string m_sRequestedTargetExt;
|
|
491 |
// Variant platform.
|
|
492 |
string m_sVariantPlatform;
|
|
493 |
// Variant type.
|
|
494 |
string m_sVariantType;
|
|
495 |
// Feature variant.
|
|
496 |
string m_sFeatureVariant;
|
|
497 |
// Feature variant name.
|
|
498 |
string m_sFeatureVariantName;
|
|
499 |
// Release path (releasables).
|
|
500 |
string m_sReleasePath;
|
|
501 |
// Full variant path (path to releasables).
|
|
502 |
string m_sFullVariantPath;
|
|
503 |
// String to store information of compile
|
|
504 |
string m_sCompileInfoText;
|
|
505 |
// String to store possible error messages.
|
|
506 |
string m_sErrors;
|
|
507 |
// Compile definition(s)
|
|
508 |
string m_sCompileDefinitions;
|
|
509 |
// Source files.
|
|
510 |
vector<SOURCE> m_vSources;
|
|
511 |
// Listing data.
|
|
512 |
vector<LINE_IN_FILE> m_vLineInFile;
|
|
513 |
// Modules map data (symbols).
|
|
514 |
vector<MAP_FUNC_INFO> m_vMapFileFuncList;
|
|
515 |
// File logging mode filename.
|
|
516 |
string m_sS60FileName;
|
|
517 |
// Is all data loaded for address to code line functions.
|
|
518 |
bool m_bAddressToLineInitialized;
|
|
519 |
// Read listing files (armv5 platform).
|
|
520 |
bool ReadListingFilesArmv5();
|
|
521 |
// Get listing file name of given source file.
|
|
522 |
string GetLstNameOfSource(string sSource) const;
|
|
523 |
// Copy listing files to temporary directory.
|
|
524 |
bool CopyLstFilesToTemp();
|
|
525 |
// Copy map file to temporary directory.
|
|
526 |
bool CopyMapFileToTemp();
|
|
527 |
// Get full map file name.
|
|
528 |
string GetMapFile() const;
|
|
529 |
// Get full symbol file name.
|
|
530 |
string GetSymbolFile() const;
|
|
531 |
// Get full binary file name.
|
|
532 |
string GetBinaryFile() const;
|
|
533 |
// Helper function to check is platform armv5.
|
|
534 |
bool IsPlatformArmv5() const;
|
|
535 |
// Get "unique" id of module
|
|
536 |
string GetUniqueId() const;
|
|
537 |
// Sbs v.1 variant urel label.
|
|
538 |
string m_sFeatureVariantURELLabel;
|
|
539 |
// Sbs v.1 variant udeb label.
|
|
540 |
string m_sFeatureVariantUDEBLabel;
|
|
541 |
// Object used to get codelines of memory addresses.
|
|
542 |
IAddressToLine* m_pAddressToLine;
|
|
543 |
};
|
|
544 |
#endif
|
|
545 |
//EOF
|