Update contrib.
1 // Copyright (c) 2004-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test/debug/d_eventtracker.h
18 #ifndef __D_EVENTTRACKER_H__
19 #define __D_EVENTTRACKER_H__
24 /** Base class for representing objects being tracked. */
29 TTrackedItem(const DBase* aObject);
33 const DBase* const iObject; // key
37 /** Subclass for representing DObjects being tracked. */
39 class TTrackedObject : public TTrackedItem
42 TTrackedObject(DObject* aObject, TObjectType aType);
43 TBool CheckIntegrity(const TDesC& aName, TObjectType aType) const;
47 const TObjectType iType;
50 /** Subclass for representing DCodeSegs being tracked. */
52 class TTrackedCodeSeg : public TTrackedItem
55 TTrackedCodeSeg(const DCodeSeg* aCodeSeg);
56 TBool CheckIntegrity(TInt aAccessCount) const;
63 /** Event handler and container for all objects being tracked. */
65 class DEventTracker : public DKernelEventHandler
69 TInt Create(DLogicalDevice* aDevice, TBool aUseHook);
75 static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
76 TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
77 TInt AddExistingObjects();
78 TInt AddObjectsFromContainer(TObjectType aType);
79 TInt AddCodeSegsFromList();
80 TInt CheckIntegrity();
81 void CheckContainerIntegrity(TObjectType aType);
82 void CheckCodeSegListIntegrity();
83 void CheckAllAccountedFor();
85 TTrackedItem* LookupItem(DBase* aItem) const;
87 void AddObject(TObjectType aType, DObject* aObject);
88 void RemoveObject(TObjectType aType, DObject* aObject);
89 void UpdateObject(TObjectType aType, DObject* aObject, TBool aMustBeRenamed);
90 void AddCodeSeg(DCodeSeg* aCodeSeg, DProcess* aProcess);
91 void RemoveCodeSeg(DCodeSeg* aCodeSeg, DProcess* aProcess);
92 void ProcessLoaded(DProcess* aProcess);
95 void DumpCounters() const;
97 static void BranchToEventHandler();
98 static TUint BreakPointSize();
100 // Dummy handler to be copied into RAM
101 static TUint DummyHandler(TKernelEvent aEvent, TAny* a1, TAny* a2);
103 // Size of dummy handler
104 static TUint DummyHandlerSize();
106 // Copy the default handler
107 static void CopyDummyHandler(TLinAddr aLinAddr);
110 /** Lock serialising calls to event handler */
113 /** Tracking list (of TTrackedItem).
114 Must be accessed only when tracking is disabled or with iLock held.
115 Object addresses are used as keys and so must be unique.
120 TInt iCounters[EEventLimit];
121 DLogicalDevice* iDevice; // open reference to LDD for avoiding lifetime issues
124 GLREF_D DEventTracker* TheEventTracker;
126 #endif // __D_EVENTTRACKER_H__