kernel/eka/drivers/debug/rmdebug/d_debug_agent.h
changeset 0 a41df078684a
child 21 e7d2d738d3c2
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 the License "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 // Purpose: Kernel-side tracking of debug agent information associated
       
    15 // with each process being debugged.
       
    16 // 
       
    17 //
       
    18 
       
    19 #ifndef D_DEBUG_AGENT_H
       
    20 #define D_DEBUG_AGENT_H
       
    21 
       
    22 #include <rm_debug_api.h>
       
    23 #include "d_driver_event_info.h"
       
    24 
       
    25 class DDebugAgent : public DBase
       
    26 {
       
    27 public:
       
    28 	static DDebugAgent* New(TUint64);
       
    29 	~DDebugAgent();
       
    30 
       
    31 	TInt SetEventAction(Debug::TEventType aEvent, Debug::TKernelEventAction aEventAction);
       
    32 	void GetEvent(TClientDataRequest<Debug::TEventInfo>* aAsyncGetValueRequest, Debug::TEventInfo* aEventInfo, DThread* aClientThread);
       
    33 	TInt EventAction(Debug::TEventType aEvent);
       
    34 
       
    35 	TInt CancelGetEvent(void);
       
    36 	void NotifyEvent(const TDriverEventInfo& aEventInfo);
       
    37 	TUint64 Id();
       
    38 
       
    39 protected:
       
    40 	DDebugAgent(TUint64 aId);
       
    41 	TInt Construct();
       
    42 
       
    43 private:
       
    44 	void QueueEvent(TDriverEventInfo& aEventInfo);
       
    45 	TBool BufferEmpty() const;
       
    46 	TBool BufferFull() const;
       
    47 	TBool BufferCanStoreEvent() const;
       
    48 	TBool BufferAtCriticalLevel() const;
       
    49 	void IncrementPosition(TInt& aPosition);
       
    50 	TInt NumberOfEmptySlots() const;
       
    51 
       
    52 private:
       
    53 	TUint64	iId;
       
    54 	Debug::TKernelEventAction iEventActions[Debug::EEventsLast];
       
    55 
       
    56 	//iEventInfo is a pointer to an object owned by the security server, so
       
    57 	//no clean up needs be performed on it
       
    58 	Debug::TEventInfo* iEventInfo;
       
    59 	RArray<TDriverEventInfo> iEventQueue;	// ring buffer.
       
    60 	TClientDataRequest<Debug::TEventInfo>* iRequestGetEventStatus;
       
    61 	DThread* iClientThread;
       
    62 
       
    63 	// Ring buffer data
       
    64 	TInt iHead;	// points to the next empty slot in iEventQueue (exc. when iFull == ETrue)
       
    65 	TInt iTail; // points to the oldest full slot in iEventQueue (exc. when iEmpty == ETrue)
       
    66 	
       
    67 	//if we have told the agent that we are ignoring trace events
       
    68 	TBool iIgnoringTrace;
       
    69 };
       
    70 
       
    71 #endif // D_DEBUG_AGENT_H
       
    72