dbgsrv/coredumpserver/ui/text/textcrashconfig.cpp
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // $Change: $
       
    15 //
       
    16 
       
    17 #include <e32cons.h>
       
    18 #include <e32debug.h>
       
    19 #include <e32test.h>
       
    20 
       
    21 #include <plugindata.h>
       
    22 #include <threaddata.h>
       
    23 #include <processdata.h>
       
    24 #include <executabledata.h>
       
    25 
       
    26 #include <coredumpinterface.h>
       
    27 
       
    28 #include <optionconfig.h>
       
    29 #include <debuglogging.h>
       
    30 
       
    31 LOCAL_C void doTestL();   // the test code
       
    32 
       
    33 GLDEF_C TInt E32Main() // main function called by E32
       
    34     {
       
    35 	__UHEAP_MARK;
       
    36 	// Because this is not an EIKON program we have to create our
       
    37 	// own clean-up stack.
       
    38 	CTrapCleanup* cleanup=CTrapCleanup::New();
       
    39 
       
    40 	__UHEAP_MARK;
       
    41 
       
    42 	// Trap any leaves that occur during test code
       
    43 	TRAPD(error,doTestL());
       
    44 	RDebug::Printf( "TRAPD(error,doTestL())=%d;\n", error);
       
    45 	// Handle any leaves that occured during the test code.
       
    46 	// Since this is a test program, we don't need any special error handling to
       
    47 	// handle leaves - just panic the test program.
       
    48 	
       
    49 	_LIT(KTxtTrainingTest,"Crash Configuration Tester");	
       
    50 
       
    51 	RDebug::Printf( "__ASSERT_ALWAYS(!error,User::Panic(KTxtTrainingTest,error));\n");
       
    52 	__ASSERT_ALWAYS(!error,User::Panic(KTxtTrainingTest,error));
       
    53 
       
    54 
       
    55 	RDebug::Printf( "__UHEAP_MARKEND; before deleting cleanup stack\n");
       
    56 	__UHEAP_MARKEND; // Check the test program doesn't leak memory.
       
    57 
       
    58 	RDebug::Printf( "delete cleanup;\n");
       
    59 	delete cleanup;
       
    60 
       
    61 	RDebug::Printf( "__UHEAP_MARKEND; before returning\n");
       
    62 	__UHEAP_MARKEND; // Check the test program doesn't leak memory.
       
    63 
       
    64 	RDebug::Printf( "__UHEAP_CHECK(0);\n");
       
    65     __UHEAP_CHECK(0);
       
    66 
       
    67 	RDebug::Printf( "E32Main returning KErrNone; \n");
       
    68 	return KErrNone;
       
    69 	}
       
    70 
       
    71 
       
    72 
       
    73 _LIT(KCrashAppFileName,"z:\\Sys\\Bin\\crashapP.exe");
       
    74 
       
    75 #define KListGranularity (20)
       
    76 
       
    77 LOCAL_C void doTestL()
       
    78 	{
       
    79 
       
    80 	// Create an RTest object for performing the tests.
       
    81 	_LIT(KTestTitle, "Crash Config - Text UI");
       
    82 	RTest test(KTestTitle);
       
    83 	CleanupClosePushL(test);
       
    84 		
       
    85 	_LIT(KFormatString1,"Connecting to Server (correct result = KErrNone)");
       
    86 	test.Start( KFormatString1 );
       
    87 
       
    88 	RDebug::Printf( "__UHEAP_MARK; //before CCrashConfig::NewL( );\n");
       
    89 	__UHEAP_MARK; // crashConfig
       
    90 
       
    91     RCoreDumpSession iSess;
       
    92 
       
    93 	RDebug::Printf( "__UHEAP_MARK; //after CCrashConfig::NewL( );\n");
       
    94 	__UHEAP_MARK; // crashConfig
       
    95 
       
    96 	// Now connect to the server.
       
    97 	test( iSess.Connect() == KErrNone );
       
    98     RDebug::Printf("connected\n");
       
    99 
       
   100 
       
   101 	_LIT(KMainMenu, "\n Menu: \n  0: Save/Load Config\t 1:List Plugins\t2:Load Plugin\n a: List Plugin Infos\tb: Unload Plugin\tc:Bind Plugins\n 3:List Threads\t4:List Procs\t5:List Exes\n 6:Observe Proc by Name\t 7 : Leave Proc by Name\t 8 : Configure System\t 9 : Create Crashing Proc\n");
       
   102 	_LIT(KConfigMenu,     "\n            0: Save Config\t 1: Load Config\n");
       
   103 	_LIT(KProcObserveMenu, "\n            Type Process ID to observe:\n");
       
   104 	
       
   105 	TChar c;
       
   106 	TBool finish = EFalse;
       
   107 	TInt ret = KErrNone;
       
   108 
       
   109 	_LIT( KSaveConfigMsg,		"Save Current Configuration to File" );
       
   110 	_LIT( KLoadConfigMsg,		"Load Configuration From File" );
       
   111 
       
   112 
       
   113 	_LIT( KGetThreadMsg,		"Request Thread List" );
       
   114 	_LIT( KGetProcMsg,			"Request Proc List" );
       
   115 	_LIT( KGetExeMsg,			"Request Executable List" );
       
   116 	
       
   117 	_LIT( KObserveProcName,	    "Observe a Process by Name" );
       
   118 	_LIT( KLeaveProcName,	    "Leave a Process by Name" );
       
   119 
       
   120 
       
   121 	RPluginList pluginsList;
       
   122 	pluginsList.Reserve(KListGranularity);
       
   123 
       
   124 	RThreadPointerList threadPtrList;
       
   125 	threadPtrList.Reserve(KListGranularity);
       
   126 
       
   127 	RProcessPointerList procPtrList;
       
   128 	procPtrList.Reserve(KListGranularity);	
       
   129 
       
   130 	RExecutablePointerList executablePtrList;
       
   131 	executablePtrList.Reserve(KListGranularity);	
       
   132 
       
   133     RPluginPointerList formatterPtrList;
       
   134     formatterPtrList.Reserve(KListGranularity);
       
   135 
       
   136     RPluginPointerList writerPtrList;
       
   137     writerPtrList.Reserve(KListGranularity);
       
   138 
       
   139 	do
       
   140 		{
       
   141 		test.Printf(KMainMenu);
       
   142 		c=test.Getch();
       
   143 
       
   144 		switch(c)
       
   145 			{
       
   146 
       
   147 			case('0'):
       
   148 				{
       
   149 				test.Printf(KConfigMenu);
       
   150 				c=test.Getch();
       
   151 				if( c == '0' )
       
   152 					{
       
   153 					test.Next(KSaveConfigMsg);
       
   154 					RDebug::Printf( "doTestL() -> SaveConfig(KNullDesc==Default )\n");
       
   155 					TRAP(ret, iSess.SaveConfigL( KNullDesC ));
       
   156 					test( KErrNone == ret );
       
   157 					RDebug::Printf( "doTestL : <- SaveConfig() returned 0x%X\n", ret );
       
   158 					}
       
   159 				else
       
   160 					{
       
   161 					test.Next(KLoadConfigMsg);
       
   162 					RDebug::Printf( "doTestL() -> LoadConfig(KNullDesc==Dafault)\n");
       
   163 					TRAP(ret, iSess.LoadConfigL( KNullDesC ));
       
   164 					test( KErrNone == ret );
       
   165 					RDebug::Printf( "doTestL : <- LoadConfig() returned 0x%X\n", ret );
       
   166 					}
       
   167 				break;
       
   168 				}
       
   169                 
       
   170 			case('1'):
       
   171 				{
       
   172 	            _LIT( KGetPluginsMsg,		"Request Plugin List" );
       
   173 				test.Next(KGetPluginsMsg);
       
   174 				pluginsList.Reset();
       
   175 
       
   176 				RDebug::Printf( "doTestL() -> GetPlugins()\n");
       
   177 
       
   178 				TRAP(ret, iSess.GetPluginListL( pluginsList ));
       
   179 				test( KErrNone == ret );
       
   180 
       
   181 				RDebug::Printf( "doTestL : <- GetPlugins() returned 0x%X, pluginList.Count()=%d, with following names:\n", 
       
   182 					ret, pluginsList.Count() );
       
   183 				
       
   184 				for(TUint i = 0; i < pluginsList.Count(); i++ )
       
   185 					{
       
   186 
       
   187 					test.Printf(_L("   Plugin List[%d].iName=%S, UID=0x%X, type=%d, loaded=%d\n"), 
       
   188 						i, 
       
   189 						&(pluginsList[i].iName),
       
   190 						pluginsList[i].iUid,
       
   191 						pluginsList[i].iType, 
       
   192 						pluginsList[i].iLoaded );
       
   193 					}
       
   194 
       
   195 				break;
       
   196 
       
   197 				}
       
   198 
       
   199 			case('a'):
       
   200 				{
       
   201 	            _LIT( KGetPluginInfosMsg,		"Request Plugin Info List" );
       
   202 				test.Next(KGetPluginInfosMsg);
       
   203 
       
   204 				formatterPtrList.ResetAndDestroy();
       
   205 				RDebug::Print( _L("doTestL() -> GetFormattersL()\n"));
       
   206 				TRAP( ret, iSess.GetFormattersL( formatterPtrList ));
       
   207 				test( KErrNone == ret );
       
   208 				RDebug::Print( _L(" doTestL() : <- GetFormatters() returned 0x%X, formatterPtrList.Count()=%d, with following names:\n"), 
       
   209 					ret, formatterPtrList.Count() );
       
   210 
       
   211 				writerPtrList.ResetAndDestroy();
       
   212 				RDebug::Print( _L("doTestL() -> GetWritersL()\n"));
       
   213 				TRAP( ret, iSess.GetWritersL( writerPtrList ));
       
   214 				test( KErrNone == ret );
       
   215 				RDebug::Print( _L(" doTestL() : <- GetWriters() returned 0x%X, writerPtrList.Count()=%d, with following names:\n"), 
       
   216 					ret, writerPtrList.Count() );
       
   217 
       
   218 				for(TUint i = 0; i < formatterPtrList.Count(); i++ )
       
   219 					{
       
   220 
       
   221 					test.Printf(_L("   Formatter List[%d].iName=%S, UID=0x%X, version=%d, type=%d\n"), 
       
   222 						i, 
       
   223 						&(formatterPtrList[i]->Name()),
       
   224 						formatterPtrList[i]->Uid(),
       
   225 						formatterPtrList[i]->Version(), 
       
   226 						formatterPtrList[i]->Type() );
       
   227 					}
       
   228 
       
   229 				for(TUint i = 0; i < writerPtrList.Count(); i++ )
       
   230 					{
       
   231 
       
   232 					test.Printf(_L("   Writter List[%d].iName=%S, UID=0x%X, version=%d, type=%d\n"), 
       
   233 						i, 
       
   234 						&(writerPtrList[i]->Name()),
       
   235 						writerPtrList[i]->Uid(),
       
   236 						writerPtrList[i]->Version(), 
       
   237 						writerPtrList[i]->Type() );
       
   238 					}
       
   239 
       
   240 				break;
       
   241 
       
   242 				}
       
   243 
       
   244 			case('2'):
       
   245 				{
       
   246 	            _LIT( KLoadPluginMsg, "Load Plugin" );
       
   247 				test.Next(KLoadPluginMsg);
       
   248 
       
   249 	            _LIT(KPluginLoadMenu, "\n\t\t\tType Index of the plugin to load:\n");
       
   250 				test.Printf(KPluginLoadMenu);
       
   251 				c=test.Getch();
       
   252 				TInt pluginIndex = c.GetNumericValue();
       
   253 
       
   254 				RDebug::Print(_L("doTestL() ->  LoadPlugin[%d].iName=%S, UID=0x%X\n"),
       
   255 							  pluginIndex, &(pluginsList[pluginIndex].iName), pluginsList[pluginIndex].iUid ) ;
       
   256 
       
   257                 TPluginRequest req;
       
   258                 req.iUid = pluginsList[pluginIndex].iUid;
       
   259                 req.iPluginType = pluginsList[pluginIndex].iType;
       
   260                 req.iLoad = ETrue;
       
   261 
       
   262                 TRAP(ret, iSess.PluginRequestL( req ));
       
   263                 test(ret == KErrNone);
       
   264                 RDebug::Printf( " Plugin with UID = 0x%X has been loaded\n", req.iUid );
       
   265                 test.Printf( _L("   Plugin with UID = 0x%X has been loaded\n"), req.iUid ); 
       
   266 
       
   267 				break;
       
   268 
       
   269 				}
       
   270             case('b'):
       
   271                 {
       
   272 	            _LIT( KLoadPluginMsg, "Unload Plugin" );
       
   273 				test.Next(KLoadPluginMsg);
       
   274 
       
   275                 TPluginRequest req;
       
   276                 req.iLoad = EFalse;
       
   277 
       
   278 	            _LIT(KPluginUnloadoadMenu, "\n\t\t\tType Index of the plugin to unload:\n");
       
   279 				test.Printf(KPluginUnloadoadMenu);
       
   280 				c=test.Getch();
       
   281 				TInt pluginIndex = c.GetNumericValue();
       
   282 
       
   283 	            _LIT(KPluginTypeUnloadMenu, "\n\t\t\tType type of the plugin to unload:[f/w]\n");
       
   284 				test.Printf(KPluginTypeUnloadMenu);
       
   285 				c=test.Getch();
       
   286 
       
   287                 if(c == 'f')
       
   288                 {
       
   289 				    RDebug::Print(_L("doTestL() ->  UnloadPlugin[%d].iName=%S, UID=0x%X\n"),
       
   290 							      pluginIndex, &(formatterPtrList[pluginIndex]->Name()), formatterPtrList[pluginIndex]->Uid() ) ;
       
   291 
       
   292                     req.iPluginType = TPluginRequest::EFormatter;
       
   293                     req.iUid = TUid::Uid(formatterPtrList[pluginIndex]->Uid());
       
   294                 }
       
   295                 else if(c == 'w')
       
   296                 {
       
   297 				    RDebug::Print(_L("doTestL() ->  UnloadPlugin[%d].iName=%S, UID=0x%X\n"),
       
   298 							      pluginIndex, &(writerPtrList[pluginIndex]->Name()), writerPtrList[pluginIndex]->Uid() ) ;
       
   299                     req.iPluginType = TPluginRequest::EWriter;
       
   300                     req.iUid = TUid::Uid(writerPtrList[pluginIndex]->Uid());
       
   301                 }
       
   302                 else
       
   303                 {
       
   304                     test.Printf(_L("Unknown plugin type!\n"));
       
   305                     break;
       
   306                 }
       
   307 
       
   308                 TRAP(ret, iSess.PluginRequestL( req ));
       
   309                 test(ret == KErrNone);
       
   310                 RDebug::Printf( " Plugin with UID = 0x%X has been unloaded\n", req.iUid );
       
   311                 test.Printf( _L("   Plugin with UID = 0x%X has been unloaded\n"), req.iUid ); 
       
   312                 break;
       
   313                 }
       
   314 
       
   315             case('c'):
       
   316                 {
       
   317 	            _LIT( KBindPluginMsg, "Bind Plugins" );
       
   318 				test.Next(KBindPluginMsg);
       
   319 
       
   320 	            _LIT(KFormatterBindMenu, "\n\t\t\tType Index of the formatter plugin to bind:\n");
       
   321 				test.Printf(KFormatterBindMenu);
       
   322 				c=test.Getch();
       
   323 				TInt formatterIndex = c.GetNumericValue();
       
   324 
       
   325 	            _LIT(KWriterBindMenu, "\n\t\t\tType Index of the writer plugin to bind:\n");
       
   326 				test.Printf(KWriterBindMenu);
       
   327 				c=test.Getch();
       
   328 				TInt writerIndex = c.GetNumericValue();
       
   329 
       
   330                 TPluginRequest req;
       
   331                 req.iIndex = formatterIndex;
       
   332                 req.iPair = writerIndex;
       
   333                 req.iUid = TUid::Uid(0); 
       
   334 
       
   335                 TRAP(ret, iSess.PluginRequestL( req ));
       
   336                 test(ret == KErrNone);
       
   337                 RDebug::Printf( " Plugin %d and %d have been bound\n", req.iIndex, req.iPair );
       
   338                 test.Printf( _L(" Plugin %d and %d have been bound\n"), req.iIndex, req.iPair );
       
   339                 break;
       
   340                 }
       
   341 
       
   342 			case('3'):
       
   343 				{
       
   344 
       
   345 				test.Next(KGetThreadMsg);
       
   346 				threadPtrList.ResetAndDestroy();
       
   347 
       
   348 				RDebug::Print( _L("doTestL() -> GetThreads()\n"));
       
   349 
       
   350 				TRAP( ret, iSess.GetThreadsL( threadPtrList ));
       
   351 				test( KErrNone == ret );
       
   352 
       
   353 				RDebug::Print( _L(" doTestL() : <- GetThreads() returned 0x%X, threadPtrList.Count()=%d, with following names:\n"), 
       
   354 					ret, threadPtrList.Count() );
       
   355 
       
   356 				RBuf rPrintBuf;
       
   357 
       
   358 				TUint64 pId;
       
   359 				TUint32 pIdLow;
       
   360 				TUint32 pIdHigh;
       
   361 
       
   362 				for(TUint i = 0; i < threadPtrList.Count(); i++ )
       
   363 					{
       
   364 					pId = threadPtrList[i]->ProcessId();
       
   365 					pIdLow = I64LOW( pId );
       
   366 					pIdHigh = I64HIGH( pId );
       
   367 
       
   368 					test.Printf(_L("   threadList[%d].iName=%S, id=0x%X"), 
       
   369 						i, &(threadPtrList[i]->Name()), threadPtrList[i]->Id() );
       
   370 					test.Printf(_L("  owner=0x%X%X\n"), pIdHigh, pIdLow );
       
   371                     }
       
   372 				}
       
   373 
       
   374 				break;
       
   375 
       
   376 			case('4'):
       
   377 				{
       
   378 
       
   379 				test.Next( KGetProcMsg );
       
   380 				procPtrList.ResetAndDestroy();
       
   381 
       
   382 				RDebug::Print( _L("doTestL() -> GetProcess()\n"));
       
   383 
       
   384                 TRAP( ret, iSess.GetProcessesL( procPtrList ));
       
   385 				test( KErrNone == ret );
       
   386 
       
   387 				RDebug::Printf( "doTestL() <- GetProcesses() returned 0x%X, procPtrList.Count()=%d, with following names:\n", 
       
   388 					ret, procPtrList.Count() );
       
   389 				
       
   390 				for(TUint i = 0; i < procPtrList.Count(); i++ )
       
   391 					{
       
   392 					test.Printf(_L("   procPtrList[%d].iName=%S, id=%d \n"), 
       
   393 						i, 
       
   394 						&(procPtrList[i]->Name()),
       
   395 						procPtrList[i]->Id() );
       
   396 					}
       
   397 
       
   398 				}
       
   399 
       
   400 				break;
       
   401 
       
   402 			case('5'):
       
   403 				{
       
   404 
       
   405 				test.Next( KGetExeMsg );
       
   406 
       
   407 				executablePtrList.ResetAndDestroy();
       
   408 
       
   409 				RDebug::Print( _L("doTestL() -> GetExecutable()\n"));
       
   410 
       
   411                 TRAP( ret, iSess.GetExecutablesL( executablePtrList ));
       
   412 				test( KErrNone == ret );
       
   413 
       
   414 				RDebug::Printf( "doTestL() <- GetExecutable() returned 0x%X, executablePtrList.Count()=%d, with following names:\n", 
       
   415 					ret, executablePtrList.Count() );
       
   416 				
       
   417 				for(TUint i = 0; i < executablePtrList.Count(); i++ )
       
   418 					{
       
   419 					test.Printf(_L("   executablePtrList[%d].iName=%S, active=%d, passive=%d, observed=%d\n"), 
       
   420 						i, 
       
   421 						&(executablePtrList[i]->Name()),
       
   422 						executablePtrList[i]->ActivelyDebugged(),
       
   423 						executablePtrList[i]->PassivelyDebugged(),
       
   424 						executablePtrList[i]->Observed() );
       
   425 					}		
       
   426 				}
       
   427 
       
   428 				break;
       
   429 
       
   430 
       
   431 			case('6'):
       
   432 				{
       
   433 
       
   434 				test.Next( KObserveProcName );
       
   435 				c=test.Getch();
       
   436 				TInt procId1 = c.GetNumericValue();
       
   437 				c=test.Getch();
       
   438 				TInt procId2 = c.GetNumericValue();
       
   439 				c=test.Getch();
       
   440 				TInt procId3 = c.GetNumericValue();
       
   441 
       
   442 				TInt procId = procId1 * 100 + 10 * procId2 + procId3;
       
   443 
       
   444 				TBool found = EFalse;
       
   445 				TUint i;
       
   446 				for( i = 0; i < procPtrList.Count(); i++ )
       
   447 					{
       
   448 
       
   449 					if( procId == procPtrList[i]->Id() )
       
   450 						{
       
   451 							found = ETrue;
       
   452 							break;
       
   453 						}
       
   454 					}
       
   455 
       
   456 				if( found )
       
   457 					{
       
   458 					RDebug::Print( _L("doTestL() : -> Observe( proc name: %S )\n"), &procPtrList[i]->Name() );
       
   459 
       
   460                     TRAP(ret, iSess.ObservationRequestL( procPtrList[i]->Name(), procPtrList[i]->Name(), ETrue) );
       
   461 
       
   462 					RDebug::Printf( "doTestL() <- Observe() returned %d\n", ret );
       
   463 
       
   464 					test( KErrNone == ret );
       
   465 
       
   466 					}
       
   467 			
       
   468 				}
       
   469 
       
   470 				break;
       
   471 
       
   472 			case('7'):
       
   473 				{
       
   474 
       
   475 				test.Next( KLeaveProcName );
       
   476 
       
   477 				test.Printf( KProcObserveMenu );
       
   478 				c=test.Getch();
       
   479 				TInt procId1 = c.GetNumericValue();
       
   480 				c=test.Getch();
       
   481 				TInt procId2 = c.GetNumericValue();
       
   482 				c=test.Getch();
       
   483 				TInt procId3 = c.GetNumericValue();
       
   484 
       
   485 				TInt procId = procId1 * 100 + 10 * procId2 + procId3;
       
   486 
       
   487 				TBool found = EFalse;
       
   488 				TUint i;
       
   489 				for( i = 0; i < procPtrList.Count(); i++ )
       
   490 					{
       
   491 
       
   492 					if( procId == procPtrList[i]->Id() )
       
   493 						{
       
   494 							found = ETrue;
       
   495 							break;
       
   496 						}
       
   497 					}
       
   498 
       
   499 				if( found )
       
   500 					{
       
   501 					RDebug::Print( _L("doTestL() : -> Leave( proc name: %S )\n"), &procPtrList[i]->Name() );
       
   502 
       
   503                     TRAP(ret, iSess.ObservationRequestL( procPtrList[i]->Name(), procPtrList[i]->Name(), EFalse) );
       
   504 
       
   505 					RDebug::Printf( "doTestL() <- Leave() returned %d\n", ret );
       
   506 
       
   507 					test( KErrNone == ret );
       
   508 
       
   509 					}
       
   510 			
       
   511 				}
       
   512 
       
   513 				break;
       
   514                 
       
   515 
       
   516 			case('8'):
       
   517 				{
       
   518 	            _LIT( KConfigureSystem,     "Configure the System Parameters" );
       
   519 				test.Next( KConfigureSystem );
       
   520 
       
   521 				TInt numConfigParams = -1;
       
   522 			
       
   523 				RPointerArray<COptionConfig> configParams;
       
   524 				COptionConfig * config = NULL;
       
   525 
       
   526 				numConfigParams = iSess.GetNumberConfigParametersL();
       
   527 				RDebug::Printf( "There are %d system params\n", numConfigParams );
       
   528 
       
   529                 for(TInt i = 0 ; i < numConfigParams; i++)
       
   530                 {
       
   531 				    config = iSess.GetConfigParameterL(i);
       
   532                     configParams.AppendL(config);
       
   533                 }
       
   534 
       
   535                 for(TInt i = 0 ; i < numConfigParams; i++)
       
   536                 {
       
   537                     config = configParams[i];
       
   538                     RDebug::Printf("param[%d] index=%d, instance=%d, source=%d, type=%d, value=%d values=%S",
       
   539                                    i, config->Index(), config->Instance(), config->Source(), config->Type(),
       
   540                                    config->Value(), &config->ValueAsDesc() );
       
   541                 }
       
   542 
       
   543                 configParams.ResetAndDestroy();
       
   544 
       
   545 	            _LIT(KFormatterConfigMenu, "\n\t\t\tType Index of the parameter to change:\n");
       
   546 				test.Printf(KFormatterConfigMenu);
       
   547 				c=test.Getch();
       
   548 				TInt paramIndex = c.GetNumericValue();
       
   549 
       
   550 				config = iSess.GetConfigParameterL( paramIndex );
       
   551 				if(config)
       
   552                 {
       
   553                     const TDesC & lastPrompt = config->Prompt();
       
   554                     const TDesC & lastOpts = config->Options();
       
   555 
       
   556                     RBuf printPromptBuf;
       
   557                     printPromptBuf.Create( lastPrompt , lastPrompt.Length()+1 );
       
   558                     //printPromptBuf.SetMax();
       
   559                     char* clPrompt = (char*) printPromptBuf.Collapse().PtrZ();
       
   560                     RDebug::Printf("  lastPrompt=%s, length=%d\n", clPrompt, printPromptBuf.Length() );
       
   561                     printPromptBuf.Close();
       
   562 
       
   563                     RBuf printOptsBuf;
       
   564                     printOptsBuf.Create( lastOpts , lastOpts.Length()+1 );
       
   565                     //printPromptBuf.SetMax();
       
   566                     char* clOpts = (char*) printOptsBuf.Collapse().PtrZ();
       
   567                     RDebug::Printf("  lastOpts=%s, length=%d\n", clOpts , printOptsBuf.Length() );
       
   568                     printOptsBuf.Close();
       
   569 
       
   570                     RDebug::Printf("  Enter param value:\n" );
       
   571                     c=test.Getch();
       
   572                     TInt paramValue = c.GetNumericValue();
       
   573                     LOG_MSG3( "  ->SetConfigParameterL( paramIndex=%d, value=%d )\n", paramIndex, paramValue );
       
   574                     config->ValueL( KNullDesC );//To let us change the value as an int
       
   575                     config->Value( paramValue );
       
   576                     TRAP(ret, iSess.SetConfigParameterL(*config) );
       
   577                     delete config;
       
   578 				    config = iSess.GetConfigParameterL( paramIndex );
       
   579                     if(config)
       
   580                     {
       
   581                         RDebug::Printf( "param[%d] index=%d, instance=%d, type=%d, source=%d, value=%d values=%S",
       
   582                                 config->Index(), config->Instance(), config->Type(), config->Source(),
       
   583                                 config->Value(), &config->ValueAsDesc() );
       
   584                     }
       
   585                     test(KErrNone == ret);
       
   586                 }
       
   587 				break;
       
   588 				}
       
   589 
       
   590 
       
   591 			case('9'):
       
   592 				{
       
   593 
       
   594 				// Create crashing app
       
   595 				RProcess iCrashProcess;
       
   596 				RDebug::Printf( "Creating crashing application\n" );
       
   597 				TInt err = iCrashProcess.Create( KCrashAppFileName, KNullDesC );
       
   598 				test( err == KErrNone );
       
   599 
       
   600 				User::After( 1000000 );
       
   601 				iCrashProcess.Resume();
       
   602 				//
       
   603 				
       
   604 				break;
       
   605 				}
       
   606 
       
   607 			case('q'):
       
   608 				{
       
   609 				iSess.Disconnect();
       
   610 				finish = ETrue;
       
   611 				break;
       
   612 				}
       
   613 
       
   614 			default:
       
   615 				{
       
   616 				break;
       
   617 				}
       
   618 
       
   619 			}// switch
       
   620 
       
   621 		}
       
   622 	while( finish == EFalse );
       
   623 
       
   624 	RDebug::Printf( "pluginsList.Close();\n");
       
   625 	pluginsList.Close();
       
   626 
       
   627 	RDebug::Printf( "threadPtrList.ResetAndDestroy();\n");
       
   628 	threadPtrList.ResetAndDestroy();
       
   629 
       
   630 	RDebug::Printf( "procPtrList.ResetAndDestroy();\n");
       
   631 	procPtrList.ResetAndDestroy();
       
   632 
       
   633 	RDebug::Printf( "executablePtrList.ResetAndDestroy();\n");
       
   634 	executablePtrList.ResetAndDestroy();
       
   635 
       
   636 
       
   637 	RDebug::Printf( "formatterPtrList.ResetAndDestroy();\n");
       
   638 	formatterPtrList.ResetAndDestroy();
       
   639 
       
   640 	RDebug::Printf( "writerPtrList.ResetAndDestroy();\n");
       
   641 	writerPtrList.ResetAndDestroy();
       
   642 
       
   643 	__UHEAP_MARKEND; 
       
   644 	__UHEAP_MARKEND; 
       
   645 
       
   646 	RDebug::Printf( "CleanupStack::Pop(); // test\n");
       
   647 	CleanupStack::Pop(); // test
       
   648 	RDebug::Printf( "test.End();\n");
       
   649 	test.End();
       
   650 	_LIT(KPressAnyKey, "\nPress any key\n");
       
   651 	test.Printf(KPressAnyKey);
       
   652 	RDebug::Printf( "test.Getch();\n");
       
   653 	test.Getch();
       
   654 	test.Close();
       
   655 	}