246 return handled; |
249 return handled; |
247 } |
250 } |
248 |
251 |
249 |
252 |
250 TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
253 TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
251 { |
254 { |
252 // TODO: to remove support of tabs |
|
253 TKeyResponse resp = EKeyWasNotConsumed; |
255 TKeyResponse resp = EKeyWasNotConsumed; |
254 if ( iTabs && ( aKeyEvent.iScanCode == EStdKeyRightArrow || aKeyEvent.iScanCode == EStdKeyLeftArrow ) ) |
256 resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType ); |
255 { |
257 //} |
256 resp = iTabs->OfferKeyEventL( aKeyEvent, aType ); |
|
257 } |
|
258 else |
|
259 { |
|
260 resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType ); |
|
261 } |
|
262 return resp; |
258 return resp; |
263 } |
259 } |
264 |
260 |
265 |
|
266 void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ ) |
261 void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ ) |
267 { |
262 { |
268 /* TODO: tabs removed |
|
269 iObjectType = (TMemSpyDriverContainerType)iTabs->ActiveTabId(); |
|
270 RefreshL(); |
|
271 */ |
|
272 } |
263 } |
273 |
264 |
274 |
265 |
275 void CMemSpyViewKernelObjects::OnCmdTerminateL() |
266 void CMemSpyViewKernelObjects::OnCmdTerminateL() |
276 { |
267 { |
277 switch ( iObjectType ) |
268 switch ( iObjectType ) |
278 { |
269 { |
279 case EMemSpyDriverContainerTypeThread: |
270 case EMemSpyDriverContainerTypeThread: |
280 { |
271 { |
|
272 TBool err = EFalse; |
281 TBool doTerminate = ETrue; |
273 TBool doTerminate = ETrue; |
282 |
274 |
283 //CMemSpyEngineObjectContainer& container = iEngine.Container(); |
275 //CMemSpyEngineObjectContainer& container = iEngine.Container(); |
284 //TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); |
276 //TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); |
285 TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread |
277 TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread |
286 |
278 |
287 TBool err; |
|
288 iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); |
279 iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); |
289 |
280 |
290 // Try to find the thread in question... |
281 // Try to find the thread in question... |
291 //CMemSpyProcess* process = NULL; |
282 //CMemSpyProcess* process = NULL; |
292 //CMemSpyThread* thread = NULL; |
283 //CMemSpyThread* thread = NULL; |
317 if ( doTerminate ) |
309 if ( doTerminate ) |
318 { |
310 { |
319 thread->TerminateL(); |
311 thread->TerminateL(); |
320 } |
312 } |
321 } |
313 } |
322 */ |
314 */ |
323 RefreshL(); |
|
324 break; |
315 break; |
325 } |
316 } |
326 case EMemSpyDriverContainerTypeProcess: |
317 case EMemSpyDriverContainerTypeProcess: |
327 { |
318 { |
|
319 TBool err = EFalse; |
328 TBool doTerminate = ETrue; |
320 TBool doTerminate = ETrue; |
|
321 TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); |
|
322 iMemSpySession.ProcessSystemPermanentOrCritical( id, err ); |
|
323 |
|
324 if( err ) |
|
325 { |
|
326 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
|
327 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
|
328 |
|
329 if( doTerminate ) |
|
330 { |
|
331 iMemSpySession.EndProcess( id, ETerminate ); |
|
332 RefreshL(); |
|
333 } |
|
334 } |
|
335 |
329 // Obtain the process that corresponds to the selected item |
336 // Obtain the process that corresponds to the selected item |
330 //CMemSpyEngineObjectContainer& container = iEngine.Container(); |
337 /* |
331 //TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); |
338 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
332 TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); |
339 TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); |
333 |
|
334 CMemSpyProcess& process = container.ProcessByIdL( id ); |
340 CMemSpyProcess& process = container.ProcessByIdL( id ); |
335 process.Open(); |
341 process.Open(); |
336 |
342 |
337 if ( process.IsSystemPermanent() || process.IsSystemCritical() ) |
343 if ( process.IsSystemPermanent() || process.IsSystemCritical() ) |
338 { |
344 { |
339 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
345 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
340 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
346 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
341 } |
347 } |
342 // |
348 // |
343 if ( doTerminate ) |
349 if ( doTerminate ) |
344 { |
350 { |
345 process.TerminateL(); |
351 process.TerminateL(); |
346 RefreshL(); |
352 RefreshL(); |
347 } |
353 }*/ |
|
354 |
348 break; |
355 break; |
349 } |
356 } |
350 default: |
357 default: |
351 { |
358 { |
352 // Programming error |
359 // Programming error |
493 if ( doTerminate ) |
551 if ( doTerminate ) |
494 { |
552 { |
495 process.KillL(); |
553 process.KillL(); |
496 RefreshL(); |
554 RefreshL(); |
497 } |
555 } |
498 |
556 */ |
499 break; |
557 break; |
500 } |
558 } |
501 default: |
559 default: |
502 { |
560 { |
503 // Programming error |
561 // Programming error |
504 __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); |
562 __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); |
505 } |
563 } |
506 } */ |
564 } |
507 } |
565 } |
508 |
566 |
509 |
567 |
510 void CMemSpyViewKernelObjects::OnCmdPanicL() |
568 void CMemSpyViewKernelObjects::OnCmdPanicL() |
511 {/* |
569 { |
512 switch ( iObjectType ) |
570 switch ( iObjectType ) |
513 { |
571 { |
514 case EMemSpyDriverContainerTypeThread: |
572 case EMemSpyDriverContainerTypeThread: |
515 { |
573 { |
|
574 TBool err = EFalse; |
516 TBool doTerminate = ETrue; |
575 TBool doTerminate = ETrue; |
517 |
576 |
518 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
577 TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread |
519 TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); |
578 iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); |
520 |
579 |
521 // Try to find the thread in question... |
580 if( err ) |
522 CMemSpyProcess* process = NULL; |
581 { |
523 CMemSpyThread* thread = NULL; |
582 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
524 User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); |
583 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
525 |
584 |
526 if ( thread ) |
585 if ( doTerminate ) |
527 { |
586 { |
528 thread->Open(); |
587 iMemSpySession.EndThread( id, EPanic ); |
529 // |
588 RefreshL(); |
530 if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) |
589 } |
531 { |
590 } |
532 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
591 |
533 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
|
534 } |
|
535 // |
|
536 if ( doTerminate ) |
|
537 { |
|
538 thread->PanicL(); |
|
539 } |
|
540 } |
|
541 RefreshL(); |
|
542 break; |
592 break; |
543 } |
593 } |
544 case EMemSpyDriverContainerTypeProcess: |
594 case EMemSpyDriverContainerTypeProcess: |
545 { |
595 { |
|
596 TBool err = EFalse; |
546 TBool doTerminate = ETrue; |
597 TBool doTerminate = ETrue; |
547 // Obtain the process that corresponds to the selected item |
598 TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); |
548 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
599 iMemSpySession.ProcessSystemPermanentOrCritical( id, err ); |
549 TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); |
600 |
550 CMemSpyProcess& process = container.ProcessByIdL( id ); |
601 if( err ) |
551 process.Open(); |
602 { |
552 |
603 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
553 if ( process.IsSystemPermanent() || process.IsSystemCritical() ) |
604 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
554 { |
605 |
555 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
606 if( doTerminate ) |
556 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
607 { |
557 } |
608 iMemSpySession.EndProcess( id, EPanic ); |
558 if ( doTerminate ) |
609 RefreshL(); |
559 { |
610 } |
560 process.PanicL(); |
611 } |
561 RefreshL(); |
612 |
562 } |
|
563 break; |
613 break; |
564 } |
614 } |
565 default: |
615 default: |
566 { |
616 { |
567 // Programming error |
617 // Programming error |
568 __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); |
618 __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); |
569 } |
619 } |
570 }*/ |
620 } |
571 } |
621 } |
572 |
622 |
573 |
623 |
574 void CMemSpyViewKernelObjects::CreateTabsL() |
624 void CMemSpyViewKernelObjects::CreateTabsL() |
575 { |
625 { |
|
626 TMemSpyDriverContainerType type = iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Type(); |
|
627 const TPtrC pType( TypeAsString( type ) ); |
|
628 |
576 CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane(); |
629 CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane(); |
577 TUid uid; |
630 TUid uid; |
578 uid.iUid = EEikStatusPaneUidNavi; |
631 uid.iUid = EEikStatusPaneUidNavi; |
579 iNaviPane = ( CAknNavigationControlContainer * ) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
632 iNaviPane = ( CAknNavigationControlContainer * ) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
580 iNavDecorator=iNaviPane->CreateMessageLabelL(_L("Kernel Object Type")); //TODO: To print there kernel object type |
633 iNavDecorator=iNaviPane->CreateMessageLabelL( pType ); |
581 iNaviPane->PushL(*iNavDecorator); |
634 iNaviPane->PushL(*iNavDecorator); |
582 /* |
635 } |
583 CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane(); |
636 |
584 TUid uid; |
637 TPtrC CMemSpyViewKernelObjects::TypeAsString( TMemSpyDriverContainerType aType ) |
585 uid.iUid = EEikStatusPaneUidNavi; |
638 { |
586 iNavDecorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top(); |
639 _LIT( KTypeUnknown, "Unknown Type" ); |
587 |
640 _LIT( KTypeThread, "Thread" ); |
588 if ( !iNavDecorator ) |
641 _LIT( KTypeProcess, "Process" ); |
589 { |
642 _LIT( KTypeChunk, "Chunk" ); |
590 iNavContainer = (CAknNavigationControlContainer*)statusPane->ControlL(uid); |
643 _LIT( KTypeLibrary, "Library" ); |
591 iNavDecorator = iNavContainer->CreateTabGroupL(); |
644 _LIT( KTypeSemaphore, "Semaphore" ); |
592 |
645 _LIT( KTypeMutex, "Mutex" ); |
593 iTabs = ( CAknTabGroup* )iNavDecorator->DecoratedControl(); |
646 _LIT( KTypeTimer, "Timer" ); |
594 iTabs->SetTabFixedWidthL( KTabWidthWithThreeLongTabs ); |
647 _LIT( KTypeServer, "Server" ); |
595 |
648 _LIT( KTypeSession, "Session" ); |
596 for ( TInt i = 0; i < iModel->Count(); i++ ) |
649 _LIT( KTypeLogicalDevice, "Logical Device" ); |
597 { |
650 _LIT( KTypePhysicalDevice, "Physical Device" ); |
598 const CMemSpyEngineGenericKernelObjectList& item = iModel->At( i ); |
651 _LIT( KTypeLogicalChannel, "Logical Channel" ); |
599 iTabs->AddTabL( item.Type(), item.TypeAsString( item.Type() ) ); |
652 _LIT( KTypeChangeNotifier, "Change Notifier" ); |
600 } |
653 _LIT( KTypeUndertaker, "Undertaker" ); |
601 iTabs->SetActiveTabById( iObjectType ); |
654 _LIT( KTypeMsgQueue, "Msg. Queue" ); |
602 iTabs->SetObserver( this ); |
655 _LIT( KTypePropertyRef, "Property Ref." ); |
603 iNavContainer->PushL( *iNavDecorator ); |
656 _LIT( KTypeCondVar, "Conditional Var." ); |
604 } |
657 // |
605 */ |
658 TPtrC pType( KTypeUnknown ); |
606 } |
659 // |
607 |
660 switch( aType ) |
|
661 { |
|
662 case EMemSpyDriverContainerTypeThread: |
|
663 pType.Set( KTypeThread ); |
|
664 break; |
|
665 case EMemSpyDriverContainerTypeProcess: |
|
666 pType.Set( KTypeProcess ); |
|
667 break; |
|
668 case EMemSpyDriverContainerTypeChunk: |
|
669 pType.Set( KTypeChunk ); |
|
670 break; |
|
671 case EMemSpyDriverContainerTypeLibrary: |
|
672 pType.Set( KTypeLibrary ); |
|
673 break; |
|
674 case EMemSpyDriverContainerTypeSemaphore: |
|
675 pType.Set( KTypeSemaphore ); |
|
676 break; |
|
677 case EMemSpyDriverContainerTypeMutex: |
|
678 pType.Set( KTypeMutex ); |
|
679 break; |
|
680 case EMemSpyDriverContainerTypeTimer: |
|
681 pType.Set( KTypeTimer ); |
|
682 break; |
|
683 case EMemSpyDriverContainerTypeServer: |
|
684 pType.Set( KTypeServer ); |
|
685 break; |
|
686 case EMemSpyDriverContainerTypeSession: |
|
687 pType.Set( KTypeSession ); |
|
688 break; |
|
689 case EMemSpyDriverContainerTypeLogicalDevice: |
|
690 pType.Set( KTypeLogicalDevice ); |
|
691 break; |
|
692 case EMemSpyDriverContainerTypePhysicalDevice: |
|
693 pType.Set( KTypePhysicalDevice ); |
|
694 break; |
|
695 case EMemSpyDriverContainerTypeLogicalChannel: |
|
696 pType.Set( KTypeLogicalChannel ); |
|
697 break; |
|
698 case EMemSpyDriverContainerTypeChangeNotifier: |
|
699 pType.Set( KTypeChangeNotifier ); |
|
700 break; |
|
701 case EMemSpyDriverContainerTypeUndertaker: |
|
702 pType.Set( KTypeUndertaker ); |
|
703 break; |
|
704 case EMemSpyDriverContainerTypeMsgQueue: |
|
705 pType.Set( KTypeMsgQueue ); |
|
706 break; |
|
707 case EMemSpyDriverContainerTypePropertyRef: |
|
708 pType.Set( KTypePropertyRef ); |
|
709 break; |
|
710 case EMemSpyDriverContainerTypeCondVar: |
|
711 pType.Set( KTypeCondVar ); |
|
712 break; |
|
713 |
|
714 default: |
|
715 break; |
|
716 } |
|
717 // |
|
718 return pType; |
|
719 } |
608 |
720 |
609 void CMemSpyViewKernelObjects::DetailsL() |
721 void CMemSpyViewKernelObjects::DetailsL() |
610 { |
722 { |
611 HBufC* messageBuf = HBufC::NewLC( 40960 ); |
723 HBufC* messageBuf = HBufC::NewLC( 40960 ); |
612 TPtr messagePtr = messageBuf->Des(); |
724 TPtr messagePtr = messageBuf->Des(); |