--- a/analyzetool/commandlineengine/src/CATProject.cpp Wed Sep 15 00:19:18 2010 +0300
+++ b/analyzetool/commandlineengine/src/CATProject.cpp Wed Sep 15 13:53:27 2010 +0300
@@ -19,6 +19,7 @@
#include "../inc/CATProject.h"
#include "../inc/CATModule2.h"
#include "../inc/CATParseTraceFile.h"
+#include "../inc/CATParseBinaryFile.h"
#include "../inc/CATDatParser.h"
//dbghelp.dll version function.
@@ -51,10 +52,12 @@
m_sDataFile = "";
m_sDataFileOutput = "";
m_sDataFileTemp = "";
+ m_sBinaryLogFileTemp = "";
m_sEpocRoot = "\\";
m_sMakeFile = "";
m_sPlatform = "";
m_sS60FileName = "";
+ m_sS60FilePath = "";
m_sTargetModule = "";
m_sVariant = "";
@@ -84,6 +87,14 @@
if ( FileExists( m_sDataFileTemp.c_str() ) )
FileDelete( m_sDataFileTemp, false );
}
+
+ // Temporary trace file
+ if ( !m_sBinaryLogFileTemp.empty() )
+ {
+ if ( FileExists( m_sBinaryLogFileTemp.c_str() ) )
+ FileDelete( m_sBinaryLogFileTemp, false );
+ }
+
}
bool CATProject::SetArguments( ARGUMENTS& arguments )
@@ -180,10 +191,14 @@
bRet = false;
}
- //Internal data file.
+ //Internal data file name.
if ( arguments.HOOK.bDataFileName )
SetS60FileName( arguments.HOOK.sDataFileName );
+ //Internal data file path.
+ if ( arguments.HOOK.bDataFilePath )
+ SetS60FilePath( arguments.HOOK.sDataFilePath );
+
//Build command.
if ( arguments.HOOK.sBuildCmd.empty() && (
GetMode() == CATProject::COMPILE ||
@@ -503,15 +518,45 @@
{
LOG_FUNC_ENTRY("CATProject::RunAnalyze");
- // Parse data file if it is trace.
+ // Parse data file if it is not data file.
if ( !IsDataFile( m_sDataFile ) )
{
m_sDataFileTemp.clear();
m_sDataFileTemp.append( m_sDataFile );
m_sDataFileTemp.append( ".atool" );
- cout << AT_MSG << "Parsing trace file..." << endl;
+
+ // make filename for file with cleaned timestamps
+ // <m_sDataFile>.cleaned in the same place as output file
+ string sTraceFileCleaned( GetPathOrFileName( false, m_sDataFileOutput ) );
+ sTraceFileCleaned.append( GetPathOrFileName( true, m_sDataFile ) );
+ sTraceFileCleaned.append( ".cleaned" );
+
+ //check if it is binary log file
+ if( IsBinaryLogFile( m_sDataFile ) )
+ {
+ // convert binary log file to ASCII trace format
+ m_sBinaryLogFileTemp.clear();
+ m_sBinaryLogFileTemp.append( m_sDataFile );
+ m_sBinaryLogFileTemp.append( ".totraces" );
+
+ cout << AT_MSG << "Parsing binary data file..." << endl;
+
+ CATParseBinaryFile Parser;
+ stringstream dataToParse;
+ if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sBinaryLogFileTemp.c_str() ) )
+ {
+ return AT_RETURN_CODE::EMPTY_DATA_FILE;
+ }
+ m_sDataFile = m_sBinaryLogFileTemp;
+
+ }
+ else
+ {
+ cout << AT_MSG << "Parsing trace file..." << endl;
+ }
+
CATParseTraceFile Parser;
- if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sDataFileTemp.c_str() ) )
+ if ( ! Parser.StartParse( m_sDataFile.c_str(), m_sDataFileTemp.c_str(), sTraceFileCleaned.c_str() ) )
{
return AT_RETURN_CODE::EMPTY_DATA_FILE;
}
@@ -787,14 +832,17 @@
if ( m_eLoggingMode == CATProject::FILE
&& m_vModules.at(i)->GetTargetType().compare("exe") == 0 )
{
- if ( m_sS60FileName.empty() )
- cout << AT_BUILD_SUMMARY_DATA_FILE_NAME
+ cout << AT_BUILD_SUMMARY_DATA_FILE_NAME
<< m_vModules.at(i)->GetS60FileName()
<< endl;
- else
- cout << AT_BUILD_SUMMARY_DATA_FILE_NAME
- << m_sS60FileName
+
+ // if filePath not empty, use it for log file
+ if ( !m_sS60FilePath.empty() )
+ {
+ cout << AT_BUILD_SUMMARY_DATA_FILE_PATH
+ << m_sS60FilePath
<< endl;
+ }
}
}
else
@@ -1553,7 +1601,7 @@
for( size_t i = 0 ; i < m_vModules.size(); i++)
{
if( ! m_vModules.at(i)->CreateTempCpp(
- m_sS60FileName, m_eLoggingMode, m_eBuildType, m_iAllocCallStackSize, m_iFreeCallStackSize ) )
+ m_sS60FileName, m_sS60FilePath, m_eLoggingMode, m_eBuildType, m_iAllocCallStackSize, m_iFreeCallStackSize ) )
bRet = false;
}
return bRet;
@@ -1955,6 +2003,7 @@
out << m_vTargetModules.at(i) << AT_PROJECT_ATTRIBUTES_SEPARATOR;
out << endl;
out << m_sBuildCommand << endl;
+ out << m_sS60FilePath << endl;
out.close();
return true;
}
@@ -2010,6 +2059,7 @@
iSpot = sLine.find( AT_PROJECT_ATTRIBUTES_SEPARATOR );
}
in.getline( cLine, MAX_LINE_LENGTH ); m_sBuildCommand = cLine;
+ in.getline( cLine, MAX_LINE_LENGTH ); m_sS60FilePath = string( cLine );
in.close();
return true;
}
@@ -2368,6 +2418,11 @@
LOG_FUNC_ENTRY("CATProject::SetS60FileName");
m_sS60FileName = sFileName;
}
+void CATProject::SetS60FilePath( const string& sFilePath)
+{
+ LOG_FUNC_ENTRY("CATProject::SetS60FilePath");
+ m_sS60FilePath = sFilePath;
+}
void CATProject::SetRomSymbolFiles(const vector<string>& vRomSymbolFiles)
{
LOG_FUNC_ENTRY("CATProject::SetRomSymbolFiles");