sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test/debug/d_eventtracker.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef __D_EVENTTRACKER_H__
|
sl@0
|
19 |
#define __D_EVENTTRACKER_H__
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "platform.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
|
sl@0
|
24 |
/** Base class for representing objects being tracked. */
|
sl@0
|
25 |
|
sl@0
|
26 |
class TTrackedItem
|
sl@0
|
27 |
{
|
sl@0
|
28 |
public:
|
sl@0
|
29 |
TTrackedItem(const DBase* aObject);
|
sl@0
|
30 |
|
sl@0
|
31 |
public:
|
sl@0
|
32 |
SDblQueLink iLink;
|
sl@0
|
33 |
const DBase* const iObject; // key
|
sl@0
|
34 |
TBool iAccountedFor;
|
sl@0
|
35 |
};
|
sl@0
|
36 |
|
sl@0
|
37 |
/** Subclass for representing DObjects being tracked. */
|
sl@0
|
38 |
|
sl@0
|
39 |
class TTrackedObject : public TTrackedItem
|
sl@0
|
40 |
{
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
TTrackedObject(DObject* aObject, TObjectType aType);
|
sl@0
|
43 |
TBool CheckIntegrity(const TDesC& aName, TObjectType aType) const;
|
sl@0
|
44 |
|
sl@0
|
45 |
public:
|
sl@0
|
46 |
TFullName iFullName;
|
sl@0
|
47 |
const TObjectType iType;
|
sl@0
|
48 |
};
|
sl@0
|
49 |
|
sl@0
|
50 |
/** Subclass for representing DCodeSegs being tracked. */
|
sl@0
|
51 |
|
sl@0
|
52 |
class TTrackedCodeSeg : public TTrackedItem
|
sl@0
|
53 |
{
|
sl@0
|
54 |
public:
|
sl@0
|
55 |
TTrackedCodeSeg(const DCodeSeg* aCodeSeg);
|
sl@0
|
56 |
TBool CheckIntegrity(TInt aAccessCount) const;
|
sl@0
|
57 |
|
sl@0
|
58 |
public:
|
sl@0
|
59 |
TInt iAccessCount;
|
sl@0
|
60 |
};
|
sl@0
|
61 |
|
sl@0
|
62 |
|
sl@0
|
63 |
/** Event handler and container for all objects being tracked. */
|
sl@0
|
64 |
|
sl@0
|
65 |
class DEventTracker : public DKernelEventHandler
|
sl@0
|
66 |
{
|
sl@0
|
67 |
public:
|
sl@0
|
68 |
DEventTracker();
|
sl@0
|
69 |
TInt Create(DLogicalDevice* aDevice, TBool aUseHook);
|
sl@0
|
70 |
~DEventTracker();
|
sl@0
|
71 |
TInt Start();
|
sl@0
|
72 |
TInt Stop();
|
sl@0
|
73 |
|
sl@0
|
74 |
private:
|
sl@0
|
75 |
static TUint EventHandler(TKernelEvent aEvent, TAny* a1, TAny* a2, TAny* aThis);
|
sl@0
|
76 |
TUint HandleEvent(TKernelEvent aType, TAny* a1, TAny* a2);
|
sl@0
|
77 |
TInt AddExistingObjects();
|
sl@0
|
78 |
TInt AddObjectsFromContainer(TObjectType aType);
|
sl@0
|
79 |
TInt AddCodeSegsFromList();
|
sl@0
|
80 |
TInt CheckIntegrity();
|
sl@0
|
81 |
void CheckContainerIntegrity(TObjectType aType);
|
sl@0
|
82 |
void CheckCodeSegListIntegrity();
|
sl@0
|
83 |
void CheckAllAccountedFor();
|
sl@0
|
84 |
|
sl@0
|
85 |
TTrackedItem* LookupItem(DBase* aItem) const;
|
sl@0
|
86 |
|
sl@0
|
87 |
void AddObject(TObjectType aType, DObject* aObject);
|
sl@0
|
88 |
void RemoveObject(TObjectType aType, DObject* aObject);
|
sl@0
|
89 |
void UpdateObject(TObjectType aType, DObject* aObject, TBool aMustBeRenamed);
|
sl@0
|
90 |
void AddCodeSeg(DCodeSeg* aCodeSeg, DProcess* aProcess);
|
sl@0
|
91 |
void RemoveCodeSeg(DCodeSeg* aCodeSeg, DProcess* aProcess);
|
sl@0
|
92 |
void ProcessLoaded(DProcess* aProcess);
|
sl@0
|
93 |
|
sl@0
|
94 |
void StopTracking();
|
sl@0
|
95 |
void DumpCounters() const;
|
sl@0
|
96 |
|
sl@0
|
97 |
static void BranchToEventHandler();
|
sl@0
|
98 |
static TUint BreakPointSize();
|
sl@0
|
99 |
|
sl@0
|
100 |
// Dummy handler to be copied into RAM
|
sl@0
|
101 |
static TUint DummyHandler(TKernelEvent aEvent, TAny* a1, TAny* a2);
|
sl@0
|
102 |
|
sl@0
|
103 |
// Size of dummy handler
|
sl@0
|
104 |
static TUint DummyHandlerSize();
|
sl@0
|
105 |
|
sl@0
|
106 |
// Copy the default handler
|
sl@0
|
107 |
static void CopyDummyHandler(TLinAddr aLinAddr);
|
sl@0
|
108 |
|
sl@0
|
109 |
private:
|
sl@0
|
110 |
/** Lock serialising calls to event handler */
|
sl@0
|
111 |
DMutex* iLock;
|
sl@0
|
112 |
TBool iTracking;
|
sl@0
|
113 |
/** Tracking list (of TTrackedItem).
|
sl@0
|
114 |
Must be accessed only when tracking is disabled or with iLock held.
|
sl@0
|
115 |
Object addresses are used as keys and so must be unique.
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
SDblQue iItems;
|
sl@0
|
118 |
TInt iOOM;
|
sl@0
|
119 |
TInt iErrorCount;
|
sl@0
|
120 |
TInt iCounters[EEventLimit];
|
sl@0
|
121 |
DLogicalDevice* iDevice; // open reference to LDD for avoiding lifetime issues
|
sl@0
|
122 |
};
|
sl@0
|
123 |
|
sl@0
|
124 |
GLREF_D DEventTracker* TheEventTracker;
|
sl@0
|
125 |
|
sl@0
|
126 |
#endif // __D_EVENTTRACKER_H__
|