dbgsrv/coredumpserver/server/inc/corecrashhandler.h
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef CORE_CRASH_HANDLER_H
       
    25 #define CORE_CRASH_HANDLER_H
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <e32debug.h>
       
    29 #include <formatterapi.h>
       
    30 #include <debuglogging.h>
       
    31 
       
    32 class CCoreDumpSession;
       
    33 
       
    34 const TUid KUidSELFFormatterV1 = TUid::Uid(0x10282fe3);
       
    35 
       
    36 //Identifier for SELF v1
       
    37 _LIT(KSelfV1, "Symbian Elf Core Dump formatter");
       
    38 _LIT(KDexcV1, "D_EXC formatter plugin description");
       
    39 
       
    40 typedef struct GCCCrashEventInfo : TEventInfo
       
    41 {
       
    42     TTime iEventTime; 
       
    43 } TCrashEventInfo;
       
    44 
       
    45 _LIT(KCrashProcessingThread, "core_dump_processor"); //crash processing thread name
       
    46 
       
    47 /**
       
    48 Active object class that creates the thread that handles the crash generation
       
    49 @see CCoreDumpSession
       
    50 @see CTargetObserver
       
    51 @see CCoreDumpFormatter
       
    52 */
       
    53 class CCrashHandler : public CActive
       
    54 {
       
    55     static TInt Processing(TAny* aParam); //crash processing thread entry point
       
    56 
       
    57     struct TCrashThreadParams //crash processing thread params
       
    58 	    {
       
    59 	    CCoreDumpFormatter *iFormatter;
       
    60 	    TCrashInfo iCrashInfo;
       
    61 	    };
       
    62 
       
    63     enum {EEventsQueueDefaultLength = 1};    
       
    64 
       
    65 public:
       
    66 	
       
    67 	/**
       
    68 	 * Defines the type of crash we are processing and so what DS to use
       
    69 	 */
       
    70 	enum TCrashType
       
    71 		{
       
    72 		ELiveCrash,  //!< Live Application Crash
       
    73 		ESystemCrash,//!< System Crash (ie. Flash)
       
    74 		ELast        //!< ELast
       
    75 		};
       
    76 	
       
    77     static CCrashHandler* NewL(CCoreDumpSession &aCoreSess);
       
    78     static CCrashHandler* NewLC(CCoreDumpSession &aCoreSess);
       
    79     ~CCrashHandler();
       
    80 
       
    81     TBool CrashInProgress() const {return iThreadsRun > 0 ? ETrue : EFalse;};
       
    82     void HandleCrashEventL(const TCrashEventInfo &aEventInfo);
       
    83     void HandleCrashFromFlashL(const TCrashInfo& aCrashInf);
       
    84     void HandleCrashFromFlashL(const TCrashInfo& aCrashInf, const RMessage2& aMessage);
       
    85     void CancelHandleCrashFromFlash(const TCrashInfo& aCrashInf);
       
    86 
       
    87 protected:
       
    88    	CCrashHandler(CCoreDumpSession &aCoreSess);
       
    89 	void ConstructL();
       
    90 
       
    91 	virtual void RunL();
       
    92 	virtual void DoCancel();
       
    93 	virtual TInt RunError(TInt aError);
       
    94 
       
    95 private:
       
    96 	void ProcessCrashL(const TCrashInfo::TCrashSource& aType);
       
    97 	void ProcessLiveCrashL();
       
    98 	void ProcessSystemCrashL();
       
    99 	
       
   100     void StartThreadL();
       
   101     void ResetProperties(const TDesC &aProgress);
       
   102     void PostProcessL();
       
   103  
       
   104 private:
       
   105     TUint iThreadsRun; // number of running threads
       
   106     RThread iThread; //thread processing the crash
       
   107     RArray<TCrashEventInfo> iRemainingEvents; //copy of structures provided by target observer
       
   108     RArray<TCrashInfo> iRemainingFlashCrashEvents;
       
   109     RArray<TUint64> iTids;
       
   110     TCrashThreadParams iParams;
       
   111     CCoreDumpSession &iCoreSess;
       
   112 	TUint iCrashCount;
       
   113 	RMessagePtr2 iMessage;
       
   114 };
       
   115 
       
   116 #endif //CORE_CRASH_HANDLER_H