diff -r e26895079d7c -r 7fdc9a71d314 analyzetool/dynamicmemoryhook/src/customuser.cpp --- a/analyzetool/dynamicmemoryhook/src/customuser.cpp Wed Sep 15 00:19:18 2010 +0300 +++ b/analyzetool/dynamicmemoryhook/src/customuser.cpp Wed Sep 15 13:53:27 2010 +0300 @@ -23,9 +23,9 @@ #include "atlog.h" #include "analyzetoolmemoryallocator.h" #include "analyzetoolpanics.pan" -#include "atstorageservercommon.h" #include "atdriveinfo.h" #include +#include "analyzetoolfastlog.h" #ifdef USE_CLEANER_DLL // Global variable to detect dll attach & detach in process. @@ -121,7 +121,7 @@ // CONSTANTS // When needed, update the version number directly inside _LIT macro. // Constant for the atool API(staticlib) version. -_LIT( KAtoolApiVersion, "1.7.5" ); +_LIT( KAtoolApiVersion, "1.7.6" ); // Version number buffer length const TInt KAtoolVersionNumberLength = 10; @@ -133,8 +133,8 @@ _LIT( KVersionSeparator, ";" ); // Incorrect version error strings -_LIT( KIncorrectText, "ERROR_OCCURED INCORRECT_ATOOL_VERSION [API v.%S][ATOOL v.%S]" ); -_LIT( KIncorrectTextTrace, "PCSS " ); +_LIT( KIncorrectText, "ERR INCORRECT_ATOOL_VERSION [API v.%S][ATOOL v.%S]" ); +_LIT( KIncorrectTextTrace, " " ); // ----------------------------------------------------------------------------- // CustomUser::Panic() @@ -240,7 +240,7 @@ // ----------------------------------------------------------------------------- // EXPORT_C TInt CustomUser::SetupThreadHeap( TBool aNotFirst, - SStdEpocThreadCreateInfo& aInfo, const TFileName& aFileName, + SStdEpocThreadCreateInfo& aInfo, const TFileName& aFileName, const TPath& aFilePath, TUint32 aLogOption, TUint32 aIsDebug, const TATVersion& aVersion, TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize, TRefByValue aFmt, ... ) @@ -250,13 +250,18 @@ // Add handling of the argument list here. - TInt ret( KErrNone ); + TInt ret( KErrNone ); + // Check version number TBuf atoolVer; - if ( CheckVersion( aVersion, atoolVer ) != KErrNone ) + TBuf apiVer; + TInt err( KErrNone ); + err = CheckVersion( aVersion, atoolVer, apiVer ); + + if ( err ) { LOGSTR1( "ATMH > Wrong API version > Inform user and Exit." ); - ReportIncorrectVersion( aLogOption, aFileName, atoolVer ); + ReportIncorrectVersion( aLogOption, aFileName, aFilePath, atoolVer ); return KAtoolVersionError; } @@ -277,8 +282,12 @@ #endif #endif // Install the RAllocator - aInfo.iAllocator = &InstallAllocator( aNotFirst, aFileName, aLogOption, aIsDebug, - aAllocCallStackSize, aFreeCallStackSize ); + TBuf8 atoolVer8; + atoolVer8.Copy(atoolVer); + TBuf8 apiVer8; + apiVer8.Copy(apiVer); + aInfo.iAllocator = &InstallAllocator( aNotFirst, aFileName, aFilePath, aLogOption, aIsDebug, + aAllocCallStackSize, aFreeCallStackSize, atoolVer8, apiVer8 ); } else { @@ -291,6 +300,8 @@ // Switch thread heap User::SwitchAllocator( allocator ); } + + return ret; } @@ -301,8 +312,8 @@ // //lint -e{429} suppress "Custodial pointer 'allocator' has not been freed or returned" EXPORT_C RAllocator& CustomUser::InstallAllocator( TBool aNotFirst, - const TFileName& aFileName, TUint32 aLogOption, TUint32 aIsDebug, - TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize ) + const TFileName& aFileName, const TPath& aFilePath, TUint32 aLogOption, TUint32 aIsDebug, + TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize, const TDesC8& aAtoolVersion, const TDesC8& aApiVersion ) { LOGSTR1( "ATMH CustomUser::InstallAllocator()" ); @@ -331,8 +342,9 @@ LOGSTR1( "ATMH CustomUser::InstallAllocator() - first thread of the program" ); // Only one thread in the program. Must be main thread RAnalyzeToolMainAllocator* allocator = - new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aLogOption, - aIsDebug, aAllocCallStackSize, aFreeCallStackSize ); + new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aFilePath, aLogOption, + aIsDebug, aAllocCallStackSize, aFreeCallStackSize, + aAtoolVersion, aApiVersion ); __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) ); @@ -349,15 +361,14 @@ // Create new RAllocator with handles from the main thread RAnalyzeToolAllocator* allocator = new RAnalyzeToolAllocator( aNotFirst, - ((RAnalyzeToolMainAllocator*)params().iAllocator)->StorageServer(), ((RAnalyzeToolMainAllocator*)params().iAllocator)->Codeblocks(), ((RAnalyzeToolMainAllocator*)params().iAllocator)->Mutex(), ((RAnalyzeToolMainAllocator*)params().iAllocator)->ProcessId(), ((RAnalyzeToolMainAllocator*)params().iAllocator)->AnalyzeTool(), - ((RAnalyzeToolMainAllocator*)params().iAllocator)->StorageServerOpen(), ((RAnalyzeToolMainAllocator*)params().iAllocator)->LogOption(), ((RAnalyzeToolMainAllocator*)params().iAllocator)->AllocMaxCallStack(), - ((RAnalyzeToolMainAllocator*)params().iAllocator)->FreeMaxCallStack() ); + ((RAnalyzeToolMainAllocator*)params().iAllocator)->FreeMaxCallStack(), + ((RAnalyzeToolMainAllocator*)params().iAllocator)->LogFile() ); __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) ); @@ -373,8 +384,8 @@ { LOGSTR1( "ATMH CustomUser::InstallAllocator() - analyzetool.Open() returned error, creating DD" ); RAnalyzeToolMainAllocator* allocator = - new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aLogOption, aIsDebug, - aAllocCallStackSize, aFreeCallStackSize ); + new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aFilePath, aLogOption, aIsDebug, + aAllocCallStackSize, aFreeCallStackSize, aAtoolVersion, aApiVersion ); __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) ); @@ -391,7 +402,7 @@ // Check atool version // ----------------------------------------------------------------------------- // -TInt CustomUser::CheckVersion( const TATVersion& aVersion, TDes& aToolVersion ) +TInt CustomUser::CheckVersion( const TATVersion& aVersion, TDes& aToolVersion, TDes& aApiVersion ) { LOGSTR2( "ATMH CustomUser::CheckVersion(), aVersion( %S )", &aVersion ); @@ -402,9 +413,9 @@ // Find separator place TInt findplace( version.Find( KVersionSeparator() ) ); // Parse API version first [x.x.x;x.x.x] - if ( findplace >= 0 && findplace <= apiVer.MaxLength() ) + if ( findplace >= 0 && findplace <= aApiVersion.MaxLength() ) { - apiVer.Copy( version.Mid( 0, findplace ) ); + aApiVersion.Copy( version.Mid( 0, findplace ) ); version.Delete( 0, findplace + KVersionSeparator().Length() ); } @@ -412,18 +423,18 @@ { aToolVersion.Copy( version ); if ( aToolVersion.Compare( KAtoolApiVersion ) == KErrNone && - apiVer.Length() == 0 ) + aApiVersion.Length() == 0 ) { // Support 1.5.0 version (Version info: [1.5.0]) - apiVer.Copy( version ); + aApiVersion.Copy( version ); } } LOGSTR3( "ATMH > API version( %S ), ATOOL version( %S )", - &apiVer, &aToolVersion ); + &aApiVersion, &aToolVersion ); // Check version numbers - if ( apiVer.Compare( KAtoolApiVersion ) == KErrNone ) + if ( aApiVersion.Compare( KAtoolApiVersion ) == KErrNone ) { return KErrNone; } @@ -436,11 +447,11 @@ // ----------------------------------------------------------------------------- // void CustomUser::ReportIncorrectVersion( const TUint32 aLogOption, - const TFileName& aFileName, const TDes& aToolVersion ) + const TFileName& aFileName, const TPath& aFilePath, const TDes& aToolVersion ) { LOGSTR2( "ATMH CustomUser::ReportIncorrectVersion(), aFileName( %S )", &aFileName ); - + switch ( aLogOption ) { case EATLogToFile: @@ -459,7 +470,7 @@ if ( !err ) { - err = TATDriveInfo::CreatePath( logFileBuf, aFileName, fs ); + err = TATDriveInfo::CreatePath( logFileBuf, aFileName, aFilePath, fs ); // Replace file if exists if ( err && err != KErrAlreadyExists ) @@ -493,9 +504,9 @@ break; case EATUseDefault: - case EATLogToTrace: + case EATLogToTraceFast: { - LOGSTR1( "ATMH > ReportIncorrectVersion > EATLogToTrace" ); + LOGSTR1( "ATMH > ReportIncorrectVersion > EATLogToTraceFast" ); // Error msg buffer TBuf msg; msg.Copy( KIncorrectTextTrace );