51
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef MEMSPYDRIVERHEAP_H
|
|
19 |
#define MEMSPYDRIVERHEAP_H
|
|
20 |
|
|
21 |
// System includes
|
|
22 |
#include <e32cmn.h>
|
|
23 |
#include <kern_priv.h>
|
|
24 |
#include <memspy/driver/memspydriverobjectsshared.h>
|
|
25 |
#include <memspy/driver/memspydriverenumerationsshared.h>
|
|
26 |
|
|
27 |
// User includes
|
|
28 |
#include "MemSpyDriverObjectsInternal.h"
|
52
|
29 |
#include "MemSpyDriverOSAdaption.h"
|
51
|
30 |
|
|
31 |
// Constants
|
|
32 |
// We shouldn't be using any of these any more! -Tomsci
|
|
33 |
const TUint KRHeapObjectSize = 0x74;
|
|
34 |
const TUint KRAllocatorAndRHeapMemberDataOffset = 4; // 4 bytes past start of allocator address, i.e. skipping the vtable
|
|
35 |
const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset;
|
|
36 |
|
|
37 |
// Classes referenced
|
|
38 |
namespace LtkUtils
|
|
39 |
{
|
|
40 |
class RAllocatorHelper;
|
|
41 |
}
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Essentially a mirror of RAllocator and RHeap's layout.
|
|
45 |
*/
|
54
|
46 |
NONSHARABLE_CLASS(RMemSpyDriverRHeapBase)
|
51
|
47 |
{
|
|
48 |
protected:
|
|
49 |
RMemSpyDriverRHeapBase();
|
|
50 |
|
|
51 |
public: // API
|
|
52 |
void PrintInfo();
|
|
53 |
LtkUtils::RAllocatorHelper* Helper();
|
|
54 |
TMemSpyHeapInfo::THeapImplementationType GetTypeFromHelper() const;
|
|
55 |
|
|
56 |
public: // Virtual API
|
|
57 |
virtual void Reset();
|
|
58 |
virtual void Close();
|
|
59 |
virtual DChunk& Chunk() = 0;
|
|
60 |
virtual const DChunk& Chunk() const = 0;
|
52
|
61 |
virtual const TLinAddr ChunkBase() const = 0;
|
51
|
62 |
|
|
63 |
protected:
|
|
64 |
LtkUtils::RAllocatorHelper* iHelper;
|
|
65 |
};
|
|
66 |
|
54
|
67 |
NONSHARABLE_CLASS(RMemSpyDriverRHeapUser) : public RMemSpyDriverRHeapBase
|
51
|
68 |
{
|
|
69 |
public:
|
|
70 |
RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption );
|
|
71 |
TInt OpenUserHeap(DThread& aThread, TBool aEuserUdeb);
|
|
72 |
|
|
73 |
DChunk& Chunk() { return *iChunk; }
|
|
74 |
const DChunk& Chunk() const { return *iChunk; }
|
52
|
75 |
const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); }
|
51
|
76 |
|
|
77 |
private:
|
|
78 |
inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
|
52
|
79 |
inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
|
51
|
80 |
|
|
81 |
private:
|
|
82 |
DMemSpyDriverOSAdaption& iOSAdaption;
|
|
83 |
DChunk* iChunk;
|
|
84 |
};
|
|
85 |
|
|
86 |
|
54
|
87 |
NONSHARABLE_CLASS(RMemSpyDriverRHeapKernelFromCopy) : public RMemSpyDriverRHeapBase
|
51
|
88 |
{
|
|
89 |
public:
|
|
90 |
RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption );
|
|
91 |
|
|
92 |
public: // API
|
52
|
93 |
TInt AssociateWithKernelChunk( DChunk* aKernelChunk, DChunk* aCopiedChunk, TLinAddr aCopiedChunkBase, TInt aOffset );
|
|
94 |
TBool IsOpen();
|
51
|
95 |
|
|
96 |
public: // From RMemSpyDriverRHeapBase
|
52
|
97 |
void Reset();
|
|
98 |
void Close();
|
|
99 |
DChunk& Chunk();
|
|
100 |
const DChunk& Chunk() const;
|
|
101 |
const TLinAddr ChunkBase() const { return iChunkBase; }
|
51
|
102 |
|
|
103 |
private:
|
52
|
104 |
inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
|
|
105 |
inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
|
|
106 |
|
|
107 |
private:
|
|
108 |
DMemSpyDriverOSAdaption& iOSAdaption;
|
|
109 |
|
|
110 |
// Copy of the client's heap data
|
|
111 |
DChunk* iChunk;
|
|
112 |
TLinAddr iChunkBase;
|
51
|
113 |
};
|
|
114 |
|
|
115 |
|
54
|
116 |
NONSHARABLE_CLASS(RMemSpyDriverRHeapKernelInPlace) : public RMemSpyDriverRHeapBase
|
51
|
117 |
{
|
|
118 |
public:
|
52
|
119 |
RMemSpyDriverRHeapKernelInPlace( DMemSpyDriverOSAdaption& aOSAdaption );
|
51
|
120 |
TInt OpenKernelHeap();
|
|
121 |
|
|
122 |
|
|
123 |
public: // From RMemSpyDriverRHeapBase
|
|
124 |
void Close();
|
|
125 |
|
|
126 |
DChunk& Chunk();
|
|
127 |
const DChunk& Chunk() const;
|
52
|
128 |
const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); }
|
51
|
129 |
|
52
|
130 |
private:
|
|
131 |
inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; }
|
|
132 |
inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; }
|
|
133 |
|
51
|
134 |
private:
|
52
|
135 |
DMemSpyDriverOSAdaption& iOSAdaption;
|
|
136 |
|
|
137 |
// Only important member data is the base class's RAllocatorHelper
|
|
138 |
// We do cache the chunk though
|
51
|
139 |
DChunk* iChunk;
|
|
140 |
};
|
|
141 |
|
|
142 |
|
|
143 |
#endif
|