388 { |
388 { |
389 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - START - this: 0x%08x", this ) ); |
389 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - START - this: 0x%08x", this ) ); |
390 |
390 |
391 TInt err = KErrGeneral; |
391 TInt err = KErrGeneral; |
392 RProcess proc; |
392 RProcess proc; |
393 |
393 |
394 // First try with s60 UI |
394 // Try to run server first |
395 err = proc.Create( KMemSpyProcessName1, KNullDesC ); |
395 err = proc.Create( KMemSpyProcessName0, KNullDesC ); |
396 if ( err == KErrNone ) |
396 if ( err == KErrNone ) |
397 { |
397 { |
398 TFullName fullName; |
398 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Create server process successfully... - this: 0x%08x", this ) ); |
399 proc.FullName( fullName ); |
399 |
400 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Create S60 UI process successfully... - this: 0x%08x, name: %S"), this, &fullName ) ); |
400 TRequestStatus status; |
401 |
401 proc.Rendezvous( status ); |
402 TRequestStatus status; |
402 proc.Resume(); |
403 proc.Rendezvous( status ); |
403 |
404 proc.Resume(); |
404 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) ); |
405 |
405 |
406 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) ); |
406 User::WaitForRequest( status ); |
407 User::WaitForRequest( status ); |
407 err = status.Int(); |
408 err = status.Int(); |
408 proc.Close(); |
409 proc.Close(); |
409 |
410 |
410 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Rendezvous complete: %d, this: 0x%08x", err, this ) ); |
411 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Rendezvous complete: %d, this: 0x%08x", err, this ) ); |
411 } |
412 } |
412 |
|
413 // If server is not available, try with s60 UI |
|
414 if ( err != KErrNone ) |
|
415 { |
|
416 err = proc.Create( KMemSpyProcessName1, KNullDesC ); |
|
417 if ( err == KErrNone ) |
|
418 { |
|
419 TFullName fullName; |
|
420 proc.FullName( fullName ); |
|
421 TRACE( RDebug::Print( _L("[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Create S60 UI process successfully... - this: 0x%08x, name: %S"), this, &fullName ) ); |
|
422 |
|
423 TRequestStatus status; |
|
424 proc.Rendezvous( status ); |
|
425 proc.Resume(); |
|
426 |
|
427 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - MemSpy resumed, waiting for Rendezvous... - this: 0x%08x", this ) ); |
|
428 User::WaitForRequest( status ); |
|
429 err = status.Int(); |
|
430 proc.Close(); |
|
431 |
|
432 TRACE( RDebug::Printf( "[MemSpyCmdLine] CMemSpyCommandLine::LaunchMemSpyL() - Rendezvous complete: %d, this: 0x%08x", err, this ) ); |
|
433 } |
|
434 } |
|
435 |
413 if ( err != KErrNone ) |
436 if ( err != KErrNone ) |
414 { |
437 { |
415 // Try console UI |
438 // Try console UI |
416 err = proc.Create( KMemSpyProcessName2, KNullDesC ); |
439 err = proc.Create( KMemSpyProcessName2, KNullDesC ); |
417 if ( err == KErrNone ) |
440 if ( err == KErrNone ) |