diff -r 7fdc9a71d314 -r 8ad140f3dd41 analyzetool/dynamicmemoryhook/src/customuser.cpp --- a/analyzetool/dynamicmemoryhook/src/customuser.cpp Wed Sep 15 13:53:27 2010 +0300 +++ b/analyzetool/dynamicmemoryhook/src/customuser.cpp Wed Oct 13 16:17:58 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.6" ); +_LIT( KAtoolApiVersion, "1.7.5" ); // Version number buffer length const TInt KAtoolVersionNumberLength = 10; @@ -133,8 +133,8 @@ _LIT( KVersionSeparator, ";" ); // Incorrect version error strings -_LIT( KIncorrectText, "ERR INCORRECT_ATOOL_VERSION [API v.%S][ATOOL v.%S]" ); -_LIT( KIncorrectTextTrace, " " ); +_LIT( KIncorrectText, "ERROR_OCCURED INCORRECT_ATOOL_VERSION [API v.%S][ATOOL v.%S]" ); +_LIT( KIncorrectTextTrace, "PCSS " ); // ----------------------------------------------------------------------------- // CustomUser::Panic() @@ -240,7 +240,7 @@ // ----------------------------------------------------------------------------- // EXPORT_C TInt CustomUser::SetupThreadHeap( TBool aNotFirst, - SStdEpocThreadCreateInfo& aInfo, const TFileName& aFileName, const TPath& aFilePath, + SStdEpocThreadCreateInfo& aInfo, const TFileName& aFileName, TUint32 aLogOption, TUint32 aIsDebug, const TATVersion& aVersion, TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize, TRefByValue aFmt, ... ) @@ -250,18 +250,13 @@ // Add handling of the argument list here. - TInt ret( KErrNone ); - + TInt ret( KErrNone ); // Check version number TBuf atoolVer; - TBuf apiVer; - TInt err( KErrNone ); - err = CheckVersion( aVersion, atoolVer, apiVer ); - - if ( err ) + if ( CheckVersion( aVersion, atoolVer ) != KErrNone ) { LOGSTR1( "ATMH > Wrong API version > Inform user and Exit." ); - ReportIncorrectVersion( aLogOption, aFileName, aFilePath, atoolVer ); + ReportIncorrectVersion( aLogOption, aFileName, atoolVer ); return KAtoolVersionError; } @@ -282,12 +277,8 @@ #endif #endif // Install the RAllocator - TBuf8 atoolVer8; - atoolVer8.Copy(atoolVer); - TBuf8 apiVer8; - apiVer8.Copy(apiVer); - aInfo.iAllocator = &InstallAllocator( aNotFirst, aFileName, aFilePath, aLogOption, aIsDebug, - aAllocCallStackSize, aFreeCallStackSize, atoolVer8, apiVer8 ); + aInfo.iAllocator = &InstallAllocator( aNotFirst, aFileName, aLogOption, aIsDebug, + aAllocCallStackSize, aFreeCallStackSize ); } else { @@ -300,8 +291,6 @@ // Switch thread heap User::SwitchAllocator( allocator ); } - - return ret; } @@ -312,8 +301,8 @@ // //lint -e{429} suppress "Custodial pointer 'allocator' has not been freed or returned" EXPORT_C RAllocator& CustomUser::InstallAllocator( TBool aNotFirst, - const TFileName& aFileName, const TPath& aFilePath, TUint32 aLogOption, TUint32 aIsDebug, - TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize, const TDesC8& aAtoolVersion, const TDesC8& aApiVersion ) + const TFileName& aFileName, TUint32 aLogOption, TUint32 aIsDebug, + TUint32 aAllocCallStackSize, TUint32 aFreeCallStackSize ) { LOGSTR1( "ATMH CustomUser::InstallAllocator()" ); @@ -342,9 +331,8 @@ 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, aFilePath, aLogOption, - aIsDebug, aAllocCallStackSize, aFreeCallStackSize, - aAtoolVersion, aApiVersion ); + new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aLogOption, + aIsDebug, aAllocCallStackSize, aFreeCallStackSize ); __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) ); @@ -361,14 +349,15 @@ // 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)->LogFile() ); + ((RAnalyzeToolMainAllocator*)params().iAllocator)->FreeMaxCallStack() ); __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) ); @@ -384,8 +373,8 @@ { LOGSTR1( "ATMH CustomUser::InstallAllocator() - analyzetool.Open() returned error, creating DD" ); RAnalyzeToolMainAllocator* allocator = - new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aFilePath, aLogOption, aIsDebug, - aAllocCallStackSize, aFreeCallStackSize, aAtoolVersion, aApiVersion ); + new RAnalyzeToolMainAllocator( aNotFirst, aFileName, aLogOption, aIsDebug, + aAllocCallStackSize, aFreeCallStackSize ); __ASSERT_ALWAYS( allocator != NULL, AssertPanic( ENoMemory ) ); @@ -402,7 +391,7 @@ // Check atool version // ----------------------------------------------------------------------------- // -TInt CustomUser::CheckVersion( const TATVersion& aVersion, TDes& aToolVersion, TDes& aApiVersion ) +TInt CustomUser::CheckVersion( const TATVersion& aVersion, TDes& aToolVersion ) { LOGSTR2( "ATMH CustomUser::CheckVersion(), aVersion( %S )", &aVersion ); @@ -413,9 +402,9 @@ // Find separator place TInt findplace( version.Find( KVersionSeparator() ) ); // Parse API version first [x.x.x;x.x.x] - if ( findplace >= 0 && findplace <= aApiVersion.MaxLength() ) + if ( findplace >= 0 && findplace <= apiVer.MaxLength() ) { - aApiVersion.Copy( version.Mid( 0, findplace ) ); + apiVer.Copy( version.Mid( 0, findplace ) ); version.Delete( 0, findplace + KVersionSeparator().Length() ); } @@ -423,18 +412,18 @@ { aToolVersion.Copy( version ); if ( aToolVersion.Compare( KAtoolApiVersion ) == KErrNone && - aApiVersion.Length() == 0 ) + apiVer.Length() == 0 ) { // Support 1.5.0 version (Version info: [1.5.0]) - aApiVersion.Copy( version ); + apiVer.Copy( version ); } } LOGSTR3( "ATMH > API version( %S ), ATOOL version( %S )", - &aApiVersion, &aToolVersion ); + &apiVer, &aToolVersion ); // Check version numbers - if ( aApiVersion.Compare( KAtoolApiVersion ) == KErrNone ) + if ( apiVer.Compare( KAtoolApiVersion ) == KErrNone ) { return KErrNone; } @@ -447,11 +436,11 @@ // ----------------------------------------------------------------------------- // void CustomUser::ReportIncorrectVersion( const TUint32 aLogOption, - const TFileName& aFileName, const TPath& aFilePath, const TDes& aToolVersion ) + const TFileName& aFileName, const TDes& aToolVersion ) { LOGSTR2( "ATMH CustomUser::ReportIncorrectVersion(), aFileName( %S )", &aFileName ); - + switch ( aLogOption ) { case EATLogToFile: @@ -470,7 +459,7 @@ if ( !err ) { - err = TATDriveInfo::CreatePath( logFileBuf, aFileName, aFilePath, fs ); + err = TATDriveInfo::CreatePath( logFileBuf, aFileName, fs ); // Replace file if exists if ( err && err != KErrAlreadyExists ) @@ -504,9 +493,9 @@ break; case EATUseDefault: - case EATLogToTraceFast: + case EATLogToTrace: { - LOGSTR1( "ATMH > ReportIncorrectVersion > EATLogToTraceFast" ); + LOGSTR1( "ATMH > ReportIncorrectVersion > EATLogToTrace" ); // Error msg buffer TBuf msg; msg.Copy( KIncorrectTextTrace );