perfsrv/memspy/Console/Source/ConsoleMenu.cpp
changeset 48 516af714ebb4
equal deleted inserted replaced
45:185201be11b0 48:516af714ebb4
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ConsoleMenu.h"
       
    19 
       
    20 // System includes
       
    21 #include <e32debug.h>
       
    22 
       
    23 // Engine includes
       
    24 #include <memspyengineclientinterface.h>
       
    25 #include <memspy/engine/memspyengine.h>
       
    26 #include <memspy/engine/memspyenginehelperheap.h>
       
    27 #include <memspy/engine/memspyengineoutputsink.h>
       
    28 #include <memspy/engine/memspyenginehelperstack.h>
       
    29 #include <memspy/engine/memspyengineobjectthread.h>
       
    30 #include <memspy/engine/memspyengineobjectprocess.h>
       
    31 #include <memspy/engine/memspydevicewideoperations.h>
       
    32 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    33 #include <memspy/engine/memspyenginehelperkernelcontainers.h>
       
    34 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    35 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
       
    36 
       
    37 // User includes
       
    38 #include "ConsoleConstants.h"
       
    39 #include "ConsoleDWOperation.h"
       
    40 
       
    41 
       
    42 CMemSpyConsoleMenu::CMemSpyConsoleMenu( RMemSpySession& aSession, CConsoleBase& aConsole )
       
    43 :   CActive( EPriorityHigh ), iSession( aSession ), iConsole( aConsole ), iOutputType(EOutputTypeDebug)
       
    44     {
       
    45     CActiveScheduler::Add( this );
       
    46     // TODO: iEngine.SetObserver( this );
       
    47     }
       
    48 
       
    49 
       
    50 CMemSpyConsoleMenu::~CMemSpyConsoleMenu()
       
    51     {
       
    52     Cancel();
       
    53     }
       
    54 
       
    55 
       
    56 void CMemSpyConsoleMenu::ConstructL()
       
    57     {
       
    58     DrawMenuL();
       
    59     WaitForInput();
       
    60     }
       
    61 
       
    62 
       
    63 CMemSpyConsoleMenu* CMemSpyConsoleMenu::NewLC( RMemSpySession& aSession, CConsoleBase& aConsole )
       
    64     {
       
    65     CMemSpyConsoleMenu* self = new(ELeave) CMemSpyConsoleMenu( aSession, aConsole );
       
    66     CleanupStack::PushL( self );
       
    67     self->ConstructL();
       
    68     return self;
       
    69     }
       
    70 
       
    71 
       
    72 void CMemSpyConsoleMenu::DrawMenuL()
       
    73     {
       
    74     iConsole.ClearScreen();
       
    75    
       
    76     // First line - sink type (defaults to file)
       
    77     _LIT( KLine1, "1 or T. Toggle output mode between file or trace [%S]" );
       
    78     if  ( iOutputType == EOutputTypeDebug )
       
    79         {
       
    80         _LIT( KLine1Trace, "Trace" );
       
    81         iConsole.Printf( KLine1, &KLine1Trace );
       
    82         }
       
    83     else
       
    84         {
       
    85         _LIT( KLine1File, "File" );
       
    86         iConsole.Printf( KLine1, &KLine1File );
       
    87         }
       
    88     iConsole.Write( KMemSpyConsoleNewLine );
       
    89 
       
    90     // Kernel heap dump
       
    91     _LIT( KLine2, "2 or K. Dump kernel heap data" );
       
    92     iConsole.Write( KLine2 );
       
    93     iConsole.Write( KMemSpyConsoleNewLine );
       
    94 
       
    95     // Kernel heap dump
       
    96     _LIT( KLine3, "3 or O. Dump kernel object listing" );
       
    97     iConsole.Write( KLine3 );
       
    98     iConsole.Write( KMemSpyConsoleNewLine );
       
    99 
       
   100     // Heap (CSV) listing
       
   101     _LIT( KLine4, "4 or H. Heap CSV-information (for all threads)" );
       
   102     iConsole.Write( KLine4 );
       
   103     iConsole.Write( KMemSpyConsoleNewLine );
       
   104 
       
   105     // Stack (CSV) listing
       
   106     _LIT( KLine5, "5 or S. Stack CSV-information (for all threads)" );
       
   107     iConsole.Write( KLine5 );
       
   108     iConsole.Write( KMemSpyConsoleNewLine );
       
   109 
       
   110     // Heap data
       
   111     _LIT( KLine6, "6 or D. Get heap data for a user-thread" );
       
   112     iConsole.Write( KLine6 );
       
   113     iConsole.Write( KMemSpyConsoleNewLine );
       
   114 
       
   115     // Heap cell listing
       
   116     _LIT( KLine7, "7 or L. Get heap cell list for a user-thread" );
       
   117     iConsole.Write( KLine7 );
       
   118     iConsole.Write( KMemSpyConsoleNewLine );
       
   119 
       
   120     // Exit key
       
   121     _LIT( KLine8, "8 or X. Exit" );
       
   122     iConsole.Write( KLine8 );
       
   123     iConsole.Write( KMemSpyConsoleNewLine );
       
   124 
       
   125     // Spacer
       
   126     iConsole.Write( KMemSpyConsoleNewLine );
       
   127     iConsole.Write( KMemSpyConsoleNewLine );
       
   128 
       
   129     // Status message
       
   130     iStatusMessagePos = iConsole.CursorPos();
       
   131     RedrawStatusMessage();
       
   132 
       
   133     // Spacer
       
   134     iConsole.Write( KMemSpyConsoleNewLine );
       
   135 
       
   136     // Show input prompt.
       
   137     iCommandPromptPos = iConsole.CursorPos();
       
   138     RedrawInputPrompt();
       
   139     }
       
   140 
       
   141 
       
   142 void CMemSpyConsoleMenu::WaitForInput()
       
   143     {
       
   144     ASSERT( !IsActive() );
       
   145     iConsole.Read( iStatus );
       
   146     SetActive();
       
   147     }
       
   148 
       
   149 
       
   150 void CMemSpyConsoleMenu::RunL()
       
   151     {
       
   152     TKeyCode key = iConsole.KeyCode();
       
   153     //
       
   154 #ifdef _DEBUG
       
   155     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - START - key = %d", key );
       
   156 #endif
       
   157     //
       
   158     if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
       
   159         {
       
   160         TRAP_IGNORE( ProcessCommandBufferL() );
       
   161         }
       
   162     else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel )
       
   163         {
       
   164         ClearCommandBuffer();
       
   165         RedrawInputPrompt();
       
   166         }   
       
   167     else if ( key == EKeyBackspace )
       
   168         {
       
   169         const TInt cmdBufLength = iCommandBuffer.Length();
       
   170         if  ( cmdBufLength > 0 )
       
   171             {
       
   172             iCommandBuffer.SetLength( cmdBufLength - 1 );
       
   173             RedrawInputPrompt();
       
   174             }
       
   175         }
       
   176     else
       
   177         {
       
   178         TChar character( key );
       
   179         if  ( character.IsPrint() )
       
   180             {
       
   181             if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
       
   182                 {
       
   183                 iCommandBuffer.Append( TChar( key ) );
       
   184                 }
       
   185 
       
   186             RedrawInputPrompt();
       
   187             }
       
   188         }
       
   189 
       
   190     WaitForInput();
       
   191 
       
   192 #ifdef _DEBUG
       
   193     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - END" );
       
   194 #endif
       
   195     }
       
   196 
       
   197 
       
   198 void CMemSpyConsoleMenu::DoCancel()
       
   199     {
       
   200     iConsole.ReadCancel();
       
   201     }
       
   202 
       
   203 
       
   204 void CMemSpyConsoleMenu::OnCmdSinkTypeToggleL()
       
   205     {
       
   206 	iOutputType = iOutputType == EOutputTypeFile ? EOutputTypeDebug : EOutputTypeFile;
       
   207     }
       
   208 
       
   209 
       
   210 void CMemSpyConsoleMenu::OnCmdHeapDataKernelL()
       
   211     {
       
   212 #ifdef _DEBUG
       
   213     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataKernelL() - START" );
       
   214 #endif
       
   215 
       
   216     _LIT( KMsg, "Ouputting Kernel data..." );
       
   217     RedrawStatusMessage( KMsg );
       
   218 
       
   219     iSession.OutputKernelHeapDataL( iOutputType );
       
   220 
       
   221     RedrawStatusMessage( KNullDesC );
       
   222     }
       
   223 
       
   224 
       
   225 void CMemSpyConsoleMenu::OnCmdKernelObjectListingL()
       
   226     {
       
   227 #ifdef _DEBUG
       
   228     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdKernelObjectListingL() - START" );
       
   229 #endif
       
   230 
       
   231     _LIT( KMsg, "Ouputting Kernel Object listing..." );
       
   232     RedrawStatusMessage( KMsg );
       
   233     //
       
   234     iSession.OutputKernelObjectsL( iOutputType );
       
   235 
       
   236     RedrawStatusMessage( KNullDesC );
       
   237     }
       
   238 
       
   239 
       
   240 void CMemSpyConsoleMenu::OnCmdCSVListingStackL()
       
   241     {
       
   242 #ifdef _DEBUG
       
   243     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingStackL() - START" );
       
   244 #endif
       
   245 
       
   246     iSession.OutputCompactStackInfoL( iOutputType );
       
   247     }
       
   248 
       
   249 
       
   250 void CMemSpyConsoleMenu::OnCmdCSVListingHeapL()
       
   251     {
       
   252 #ifdef _DEBUG
       
   253     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingHeapL() - START" );
       
   254 #endif
       
   255 
       
   256     iSession.OutputCompactHeapInfoL( iOutputType );
       
   257     }
       
   258 
       
   259 
       
   260 void CMemSpyConsoleMenu::OnCmdHeapDataUserL()
       
   261     {
       
   262 #ifdef _DEBUG
       
   263     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START" );
       
   264 #endif
       
   265 
       
   266     GetProcessName();
       
   267 
       
   268     // Work out what to do.
       
   269     iCommandBuffer.Trim();
       
   270 
       
   271 #ifdef _DEBUG
       
   272     RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - requested dump heap for proc: %S"), &iCommandBuffer );
       
   273 #endif
       
   274 
       
   275     if  ( iCommandBuffer.Length() > 0 )
       
   276         {
       
   277         iConsole.Write( KMemSpyConsoleNewLine );
       
   278         iConsole.Write( KMemSpyConsoleNewLine );
       
   279         //
       
   280         HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 );
       
   281         TPtr pCmdBuf( cmdBuf->Des() );
       
   282         pCmdBuf.Copy( iCommandBuffer );
       
   283         pCmdBuf.Append( KMemSpyConsoleWildcardCharacter );
       
   284         
       
   285         TInt err;
       
   286         TProcessId procId;
       
   287         TRAP(err, procId = iSession.GetProcessIdByNameL(pCmdBuf));
       
   288         //
       
   289         if (err == KErrNone) 
       
   290         	{
       
   291         	RArray<CMemSpyApiThread*> threads;
       
   292         	
       
   293         	TRAP(err, iSession.GetThreadsL(procId, threads));
       
   294         	if (err == KErrNone)
       
   295         		{
       
   296 				_LIT( KProcessingRequest, "** Dumping Heap Data for thread: %S" );     	
       
   297 				TFullName fullThreadName;
       
   298 				
       
   299                 for( TInt i=0; i<threads.Count(); i++ )
       
   300                     {
       
   301                     CMemSpyApiThread* thread = threads[i];
       
   302                     //
       
   303                     fullThreadName = thread->Name();
       
   304                     iConsole.Printf( KProcessingRequest, &fullThreadName );
       
   305                     iConsole.Write( KMemSpyConsoleNewLine );
       
   306                     //
       
   307                     TRAP_IGNORE( iSession.OutputThreadHeapDataL(iOutputType, thread->Id()) );
       
   308                     
       
   309                     delete thread;
       
   310                     }
       
   311                 }
       
   312             }
       
   313 
       
   314         CleanupStack::PopAndDestroy( cmdBuf );
       
   315         DrawMenuL();
       
   316         }
       
   317     else
       
   318         {
       
   319         // Bad user data entry
       
   320         DrawMenuL();
       
   321         _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
       
   322         RedrawStatusMessage( KInvalidEntry );
       
   323         RedrawInputPrompt();
       
   324         }
       
   325     }
       
   326 
       
   327 
       
   328 void CMemSpyConsoleMenu::OnCmdHeapCellListUserL()
       
   329     {
       
   330 #ifdef _DEBUG
       
   331     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapCellListUserL() - START" );
       
   332 #endif
       
   333 
       
   334     GetProcessName();
       
   335 
       
   336     // Work out what to do.
       
   337     iCommandBuffer.Trim();
       
   338     if  ( iCommandBuffer.Length() > 0 )
       
   339         {
       
   340         iConsole.Write( KMemSpyConsoleNewLine );
       
   341         iConsole.Write( KMemSpyConsoleNewLine );
       
   342         //
       
   343         HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 );
       
   344         TPtr pCmdBuf( cmdBuf->Des() );
       
   345         pCmdBuf.Copy( iCommandBuffer );
       
   346         pCmdBuf.Append( KMemSpyConsoleWildcardCharacter );
       
   347         
       
   348         TInt err;
       
   349 		TProcessId procId;
       
   350 		TRAP(err, procId = iSession.GetProcessIdByNameL(pCmdBuf));
       
   351 		//
       
   352 		if (err == KErrNone) 
       
   353 			{
       
   354 			RArray<CMemSpyApiThread*> threads;
       
   355 			
       
   356 			TRAP(err, iSession.GetThreadsL(procId, threads));
       
   357 			if (err == KErrNone)
       
   358 				{
       
   359 				_LIT( KProcessingRequest, "** Dumping Heap Cell List for thread: %S" );     	
       
   360 				TFullName fullThreadName;
       
   361 				
       
   362 				for( TInt i=0; i<threads.Count(); i++ )
       
   363 					{
       
   364 					CMemSpyApiThread* thread = threads[i];
       
   365 					//
       
   366 					fullThreadName = thread->Name();
       
   367 					iConsole.Printf( KProcessingRequest, &fullThreadName );
       
   368 					iConsole.Write( KMemSpyConsoleNewLine );
       
   369 					//
       
   370 					TRAP_IGNORE( iSession.OutputThreadCellListL(iOutputType, thread->Id()) );
       
   371 					
       
   372 					delete thread;
       
   373 					}
       
   374 				}
       
   375 			}
       
   376         
       
   377         CleanupStack::PopAndDestroy( cmdBuf );
       
   378         DrawMenuL();
       
   379         }
       
   380     else
       
   381         {
       
   382         // Bad user data entry
       
   383         DrawMenuL();
       
   384         _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
       
   385         RedrawStatusMessage( KInvalidEntry );
       
   386         RedrawInputPrompt();
       
   387         }
       
   388     }
       
   389 
       
   390 
       
   391 void CMemSpyConsoleMenu::ClearCommandBuffer()
       
   392     {
       
   393     iCommandBuffer.Zero();
       
   394     }
       
   395 
       
   396 
       
   397 void CMemSpyConsoleMenu::ProcessCommandBufferL()
       
   398     {
       
   399     iCommandBuffer.Trim();
       
   400     //
       
   401 #ifdef _DEBUG
       
   402     RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer );
       
   403 #endif
       
   404     //
       
   405     TBool validCommand = EFalse;
       
   406     if  ( iCommandBuffer.Length() == 1 )
       
   407         {
       
   408         // Reset if not recognised...
       
   409         validCommand = ETrue;
       
   410 
       
   411         const TChar cmd = iCommandBuffer[ 0 ]; 
       
   412         switch( cmd )
       
   413             {
       
   414         case '1':
       
   415         case 't':
       
   416         case 'T':
       
   417             OnCmdSinkTypeToggleL();
       
   418             break;
       
   419         case '2':
       
   420         case 'k':
       
   421         case 'K':
       
   422             OnCmdHeapDataKernelL();
       
   423             break;
       
   424         case '3':
       
   425         case 'o':
       
   426         case 'O':
       
   427             OnCmdKernelObjectListingL();
       
   428             break;
       
   429         case '4':
       
   430         case 'h':
       
   431         case 'H':
       
   432             OnCmdCSVListingHeapL();
       
   433             break;
       
   434         case '5':
       
   435         case 's':
       
   436         case 'S':
       
   437             OnCmdCSVListingStackL();
       
   438             break;
       
   439         case '6':
       
   440         case 'd':
       
   441         case 'D':
       
   442             OnCmdHeapDataUserL();
       
   443             break;
       
   444         case '7':
       
   445         case 'l':
       
   446         case 'L':
       
   447             OnCmdHeapCellListUserL();
       
   448             break;
       
   449         case '8':
       
   450         case 'x':
       
   451         case 'X':
       
   452             CActiveScheduler::Stop();
       
   453             return; // NB: avoid redrawing menu when exiting
       
   454 
       
   455         default:
       
   456             validCommand = EFalse;
       
   457             break;
       
   458             }
       
   459         }
       
   460     //
       
   461     ClearCommandBuffer();
       
   462     //
       
   463     if  ( !validCommand )
       
   464         {
       
   465         _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" );
       
   466         RedrawStatusMessage( KInvalidEntry );
       
   467         RedrawInputPrompt();
       
   468         }
       
   469     else
       
   470         {
       
   471         DrawMenuL();
       
   472         }
       
   473 
       
   474 #ifdef _DEBUG
       
   475     RDebug::Printf( "[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - END" );
       
   476 #endif
       
   477     }
       
   478 
       
   479 
       
   480 void CMemSpyConsoleMenu::RedrawInputPrompt()
       
   481     {
       
   482     iConsole.SetCursorPosAbs( iCommandPromptPos );
       
   483     iConsole.ClearToEndOfLine();
       
   484     iConsole.Printf( KMemSpyConsoleInputPrompt, &iCommandBuffer );
       
   485     }
       
   486 
       
   487 
       
   488 void CMemSpyConsoleMenu::RedrawStatusMessage()
       
   489     {
       
   490     RedrawStatusMessage( KNullDesC );
       
   491     }
       
   492 
       
   493 
       
   494 void CMemSpyConsoleMenu::RedrawStatusMessage( const TDesC& aMessage )
       
   495     {
       
   496     iConsole.SetCursorPosAbs( iStatusMessagePos );
       
   497     iConsole.ClearToEndOfLine();
       
   498     iConsole.Write( aMessage );
       
   499     iConsole.Write( KMemSpyConsoleNewLine );
       
   500     }
       
   501 
       
   502 
       
   503 void CMemSpyConsoleMenu::GetProcessName()
       
   504     {
       
   505     iConsole.ClearScreen();
       
   506 
       
   507     _LIT( KPromptMessage1, "Enter the full or partial process name" );
       
   508     iConsole.Write( KPromptMessage1 );
       
   509     iConsole.Write( KMemSpyConsoleNewLine );
       
   510     _LIT( KPromptMessage2, "of the process that you are interested in." );
       
   511     iConsole.Write( KPromptMessage2 );
       
   512     iConsole.Write( KMemSpyConsoleNewLine );
       
   513     _LIT( KPromptMessage3, "Press \'enter\' when done." );
       
   514     iConsole.Write( KPromptMessage3 );
       
   515     iConsole.Write( KMemSpyConsoleNewLine );
       
   516     //
       
   517     ClearCommandBuffer();
       
   518     iConsole.Write( KMemSpyConsoleNewLine );
       
   519     iCommandPromptPos = iConsole.CursorPos();
       
   520     RedrawInputPrompt();
       
   521     //
       
   522     TBool done = EFalse;
       
   523     while( !done )
       
   524         {
       
   525         // Get a key
       
   526         const TKeyCode key = iConsole.Getch();
       
   527 
       
   528         // Process it
       
   529 #ifdef _DEBUG
       
   530         RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START - key = %d", key );
       
   531 #endif
       
   532         //
       
   533         if  ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter )
       
   534             {
       
   535             done = ETrue;
       
   536             }
       
   537         else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel )
       
   538             {
       
   539             ClearCommandBuffer();
       
   540             done = ETrue;
       
   541             }   
       
   542         else if ( key == EKeyBackspace )
       
   543             {
       
   544             const TInt cmdBufLength = iCommandBuffer.Length();
       
   545             if  ( cmdBufLength > 0 )
       
   546                 {
       
   547                 iCommandBuffer.SetLength( cmdBufLength - 1 );
       
   548                 RedrawInputPrompt();
       
   549                 }
       
   550             }
       
   551         else
       
   552             {
       
   553             TChar character( key );
       
   554             if  ( character.IsPrint() )
       
   555                 {
       
   556                 if  ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() )
       
   557                     {
       
   558                     iCommandBuffer.Append( TChar( key ) );
       
   559                     }
       
   560 
       
   561                 RedrawInputPrompt();
       
   562                 }
       
   563             }
       
   564         }
       
   565     }
       
   566 
       
   567 
       
   568 void CMemSpyConsoleMenu::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext )
       
   569     {
       
   570     if  ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest )
       
   571         {
       
   572         const TInt function = reinterpret_cast< TInt >( aContext );
       
   573         InitiateMemSpyClientServerOperationL( function );
       
   574         }
       
   575     }
       
   576 
       
   577 
       
   578 void CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL( TInt aOpCode )
       
   579     {
       
   580 	// TODO: ....
       
   581 //#ifdef _DEBUG
       
   582 //    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d, iRunningDeviceWideOperation: %d", aOpCode, iRunningDeviceWideOperation );
       
   583 //#endif
       
   584 //    //
       
   585 //    if ( aOpCode == EMemSpyClientServerOpExit )
       
   586 //        {
       
   587 //        // Exit console app UI
       
   588 //        CActiveScheduler::Stop();
       
   589 //        }
       
   590 //    else
       
   591 //        {
       
   592 //        CMemSpyDeviceWideOperations::TOperation op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary;
       
   593 //        switch( aOpCode )
       
   594 //            {
       
   595 //        case EMemSpyClientServerOpSummaryInfo:
       
   596 //            op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary;
       
   597 //            break;
       
   598 //        case EMemSpyClientServerOpSummaryInfoDetailed:
       
   599 //            op = CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed;
       
   600 //            break;
       
   601 //        //
       
   602 //        case EMemSpyClientServerOpHeapInfo:
       
   603 //            op = CMemSpyDeviceWideOperations::EPerEntityHeapInfo;
       
   604 //            break;
       
   605 //        case EMemSpyClientServerOpHeapCellListing:
       
   606 //            op = CMemSpyDeviceWideOperations::EPerEntityHeapCellListing;
       
   607 //            break;
       
   608 //        case EMemSpyClientServerOpHeapData:
       
   609 //            op = CMemSpyDeviceWideOperations::EPerEntityHeapData;
       
   610 //            break;
       
   611 //        //
       
   612 //        case EMemSpyClientServerOpStackInfo:
       
   613 //            op = CMemSpyDeviceWideOperations::EPerEntityStackInfo;
       
   614 //            break;
       
   615 //        case EMemSpyClientServerOpStackDataUser:
       
   616 //            op = CMemSpyDeviceWideOperations::EPerEntityStackDataUser;
       
   617 //            break;
       
   618 //        case EMemSpyClientServerOpStackDataKernel:
       
   619 //            op = CMemSpyDeviceWideOperations::EPerEntityStackDataKernel;
       
   620 //            break;
       
   621 //        
       
   622 //        // These are not supported by the console UI
       
   623 //        default:
       
   624 //        case EMemSpyClientServerOpBitmapsSave:
       
   625 //        case EMemSpyClientServerOpSendToBackground:
       
   626 //        case EMemSpyClientServerOpBringToForeground:
       
   627 //            User::Leave( KErrNotSupported );
       
   628 //            break;
       
   629 //            }
       
   630 //
       
   631 //        if  ( iRunningDeviceWideOperation )
       
   632 //            {
       
   633 //            User::Leave( KErrInUse );
       
   634 //            }
       
   635 //        else
       
   636 //            {
       
   637 //            iRunningDeviceWideOperation = ETrue;
       
   638 //            TRAP_IGNORE( CMemSpyDeviceWideOperationWaiter::ExecuteLD( iEngine, op ) );
       
   639 //            iRunningDeviceWideOperation = EFalse;
       
   640 //            }
       
   641 //        }
       
   642 //
       
   643 //#ifdef _DEBUG
       
   644 //    RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode );
       
   645 //#endif
       
   646     }
       
   647 
       
   648 
       
   649