17 |
17 |
18 |
18 |
19 #include "../inc/CATProject.h" |
19 #include "../inc/CATProject.h" |
20 #include "../inc/CATModule2.h" |
20 #include "../inc/CATModule2.h" |
21 #include "../inc/CATParseTraceFile.h" |
21 #include "../inc/CATParseTraceFile.h" |
22 #include "../inc/CATParseBinaryFile.h" |
|
23 #include "../inc/CATDatParser.h" |
22 #include "../inc/CATDatParser.h" |
24 |
23 |
25 //dbghelp.dll version function. |
24 //dbghelp.dll version function. |
26 extern int showDbgHelpVersionInfo( bool showVersion ); |
25 extern int showDbgHelpVersionInfo( bool showVersion ); |
27 |
26 |
85 if ( !m_sDataFileTemp.empty() ) |
82 if ( !m_sDataFileTemp.empty() ) |
86 { |
83 { |
87 if ( FileExists( m_sDataFileTemp.c_str() ) ) |
84 if ( FileExists( m_sDataFileTemp.c_str() ) ) |
88 FileDelete( m_sDataFileTemp, false ); |
85 FileDelete( m_sDataFileTemp, false ); |
89 } |
86 } |
90 |
|
91 // Temporary trace file |
|
92 if ( !m_sBinaryLogFileTemp.empty() ) |
|
93 { |
|
94 if ( FileExists( m_sBinaryLogFileTemp.c_str() ) ) |
|
95 FileDelete( m_sBinaryLogFileTemp, false ); |
|
96 } |
|
97 |
|
98 } |
87 } |
99 |
88 |
100 bool CATProject::SetArguments( ARGUMENTS& arguments ) |
89 bool CATProject::SetArguments( ARGUMENTS& arguments ) |
101 { |
90 { |
102 LOG_FUNC_ENTRY("CATProject::SetArguments"); |
91 LOG_FUNC_ENTRY("CATProject::SetArguments"); |
189 { |
178 { |
190 LOG_STRING( "Error, no build type specified."); |
179 LOG_STRING( "Error, no build type specified."); |
191 bRet = false; |
180 bRet = false; |
192 } |
181 } |
193 |
182 |
194 //Internal data file name. |
183 //Internal data file. |
195 if ( arguments.HOOK.bDataFileName ) |
184 if ( arguments.HOOK.bDataFileName ) |
196 SetS60FileName( arguments.HOOK.sDataFileName ); |
185 SetS60FileName( arguments.HOOK.sDataFileName ); |
197 |
|
198 //Internal data file path. |
|
199 if ( arguments.HOOK.bDataFilePath ) |
|
200 SetS60FilePath( arguments.HOOK.sDataFilePath ); |
|
201 |
186 |
202 //Build command. |
187 //Build command. |
203 if ( arguments.HOOK.sBuildCmd.empty() && ( |
188 if ( arguments.HOOK.sBuildCmd.empty() && ( |
204 GetMode() == CATProject::COMPILE || |
189 GetMode() == CATProject::COMPILE || |
205 GetMode() == CATProject::INSTRUMENT || |
190 GetMode() == CATProject::INSTRUMENT || |
516 |
501 |
517 int CATProject::RunAnalyze() |
502 int CATProject::RunAnalyze() |
518 { |
503 { |
519 LOG_FUNC_ENTRY("CATProject::RunAnalyze"); |
504 LOG_FUNC_ENTRY("CATProject::RunAnalyze"); |
520 |
505 |
521 // Parse data file if it is not data file. |
506 // Parse data file if it is trace. |
522 if ( !IsDataFile( m_sDataFile ) ) |
507 if ( !IsDataFile( m_sDataFile ) ) |
523 { |
508 { |
524 m_sDataFileTemp.clear(); |
509 m_sDataFileTemp.clear(); |
525 m_sDataFileTemp.append( m_sDataFile ); |
510 m_sDataFileTemp.append( m_sDataFile ); |
526 m_sDataFileTemp.append( ".atool" ); |
511 m_sDataFileTemp.append( ".atool" ); |
527 |
512 cout << AT_MSG << "Parsing trace file..." << endl; |
528 // make filename for file with cleaned timestamps |
|
529 // <m_sDataFile>.cleaned in the same place as output file |
|
530 string sTraceFileCleaned( GetPathOrFileName( false, m_sDataFileOutput ) ); |
|
531 sTraceFileCleaned.append( GetPathOrFileName( true, m_sDataFile ) ); |
|
532 sTraceFileCleaned.append( ".cleaned" ); |
|
533 |
|
534 //check if it is binary log file |
|
535 if( IsBinaryLogFile( m_sDataFile ) ) |
|
536 { |
|
537 // convert binary log file to ASCII trace format |
|
538 m_sBinaryLogFileTemp.clear(); |
|
539 m_sBinaryLogFileTemp.append( m_sDataFile ); |
|
540 m_sBinaryLogFileTemp.append( ".totraces" ); |
|
541 |
|
542 cout << AT_MSG << "Parsing binary data file..." << endl; |
|
543 |
|
544 CATParseBinaryFile Parser; |
|
545 stringstream dataToParse; |
|
546 if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sBinaryLogFileTemp.c_str() ) ) |
|
547 { |
|
548 return AT_RETURN_CODE::EMPTY_DATA_FILE; |
|
549 } |
|
550 m_sDataFile = m_sBinaryLogFileTemp; |
|
551 |
|
552 } |
|
553 else |
|
554 { |
|
555 cout << AT_MSG << "Parsing trace file..." << endl; |
|
556 } |
|
557 |
|
558 CATParseTraceFile Parser; |
513 CATParseTraceFile Parser; |
559 if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sDataFileTemp.c_str(), sTraceFileCleaned.c_str() ) ) |
514 if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sDataFileTemp.c_str() ) ) |
560 { |
515 { |
561 return AT_RETURN_CODE::EMPTY_DATA_FILE; |
516 return AT_RETURN_CODE::EMPTY_DATA_FILE; |
562 } |
517 } |
563 m_sDataFile = m_sDataFileTemp; |
518 m_sDataFile = m_sDataFileTemp; |
564 } |
519 } |
830 // Datafiles |
785 // Datafiles |
831 // Use module data file name if project's data file not defined. |
786 // Use module data file name if project's data file not defined. |
832 if ( m_eLoggingMode == CATProject::FILE |
787 if ( m_eLoggingMode == CATProject::FILE |
833 && m_vModules.at(i)->GetTargetType().compare("exe") == 0 ) |
788 && m_vModules.at(i)->GetTargetType().compare("exe") == 0 ) |
834 { |
789 { |
835 cout << AT_BUILD_SUMMARY_DATA_FILE_NAME |
790 if ( m_sS60FileName.empty() ) |
|
791 cout << AT_BUILD_SUMMARY_DATA_FILE_NAME |
836 << m_vModules.at(i)->GetS60FileName() |
792 << m_vModules.at(i)->GetS60FileName() |
837 << endl; |
793 << endl; |
838 |
794 else |
839 // if filePath not empty, use it for log file |
795 cout << AT_BUILD_SUMMARY_DATA_FILE_NAME |
840 if ( !m_sS60FilePath.empty() ) |
796 << m_sS60FileName |
841 { |
|
842 cout << AT_BUILD_SUMMARY_DATA_FILE_PATH |
|
843 << m_sS60FilePath |
|
844 << endl; |
797 << endl; |
845 } |
|
846 } |
798 } |
847 } |
799 } |
848 else |
800 else |
849 { |
801 { |
850 // Failed |
802 // Failed |
1599 LOG_FUNC_ENTRY("CATProject::CreateTemporaryCpps"); |
1551 LOG_FUNC_ENTRY("CATProject::CreateTemporaryCpps"); |
1600 bool bRet = true; |
1552 bool bRet = true; |
1601 for( size_t i = 0 ; i < m_vModules.size(); i++) |
1553 for( size_t i = 0 ; i < m_vModules.size(); i++) |
1602 { |
1554 { |
1603 if( ! m_vModules.at(i)->CreateTempCpp( |
1555 if( ! m_vModules.at(i)->CreateTempCpp( |
1604 m_sS60FileName, m_sS60FilePath, m_eLoggingMode, m_eBuildType, m_iAllocCallStackSize, m_iFreeCallStackSize ) ) |
1556 m_sS60FileName, m_eLoggingMode, m_eBuildType, m_iAllocCallStackSize, m_iFreeCallStackSize ) ) |
1605 bRet = false; |
1557 bRet = false; |
1606 } |
1558 } |
1607 return bRet; |
1559 return bRet; |
1608 } |
1560 } |
1609 |
1561 |
2001 out << m_iFreeCallStackSize << endl; |
1953 out << m_iFreeCallStackSize << endl; |
2002 for ( size_t i = 0 ; i < m_vTargetModules.size() ; i++ ) |
1954 for ( size_t i = 0 ; i < m_vTargetModules.size() ; i++ ) |
2003 out << m_vTargetModules.at(i) << AT_PROJECT_ATTRIBUTES_SEPARATOR; |
1955 out << m_vTargetModules.at(i) << AT_PROJECT_ATTRIBUTES_SEPARATOR; |
2004 out << endl; |
1956 out << endl; |
2005 out << m_sBuildCommand << endl; |
1957 out << m_sBuildCommand << endl; |
2006 out << m_sS60FilePath << endl; |
|
2007 out.close(); |
1958 out.close(); |
2008 return true; |
1959 return true; |
2009 } |
1960 } |
2010 // ---------------------------------------------------------------------------- |
1961 // ---------------------------------------------------------------------------- |
2011 // Reads project's (user) attributes to a file under temp folder |
1962 // Reads project's (user) attributes to a file under temp folder |
2057 m_vTargetModules.push_back( sTarget ); |
2008 m_vTargetModules.push_back( sTarget ); |
2058 sLine.erase(0, iSpot + AT_PROJECT_ATTRIBUTES_SEPARATOR.size() ); |
2009 sLine.erase(0, iSpot + AT_PROJECT_ATTRIBUTES_SEPARATOR.size() ); |
2059 iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR ); |
2010 iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR ); |
2060 } |
2011 } |
2061 in.getline( cLine, MAX_LINE_LENGTH ); m_sBuildCommand = cLine; |
2012 in.getline( cLine, MAX_LINE_LENGTH ); m_sBuildCommand = cLine; |
2062 in.getline( cLine, MAX_LINE_LENGTH ); m_sS60FilePath = string( cLine ); |
|
2063 in.close(); |
2013 in.close(); |
2064 return true; |
2014 return true; |
2065 } |
2015 } |
2066 |
2016 |
2067 // ---------------------------------------------------------------------------- |
2017 // ---------------------------------------------------------------------------- |
2416 void CATProject::SetS60FileName( const string& sFileName) |
2366 void CATProject::SetS60FileName( const string& sFileName) |
2417 { |
2367 { |
2418 LOG_FUNC_ENTRY("CATProject::SetS60FileName"); |
2368 LOG_FUNC_ENTRY("CATProject::SetS60FileName"); |
2419 m_sS60FileName = sFileName; |
2369 m_sS60FileName = sFileName; |
2420 } |
2370 } |
2421 void CATProject::SetS60FilePath( const string& sFilePath) |
|
2422 { |
|
2423 LOG_FUNC_ENTRY("CATProject::SetS60FilePath"); |
|
2424 m_sS60FilePath = sFilePath; |
|
2425 } |
|
2426 void CATProject::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles) |
2371 void CATProject::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles) |
2427 { |
2372 { |
2428 LOG_FUNC_ENTRY("CATProject::SetRomSymbolFiles"); |
2373 LOG_FUNC_ENTRY("CATProject::SetRomSymbolFiles"); |
2429 m_vRomSymbolFiles = vRomSymbolFiles; |
2374 m_vRomSymbolFiles = vRomSymbolFiles; |
2430 } |
2375 } |