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