24 #include <memspy/driver/memspydriverobjectsshared.h> |
24 #include <memspy/driver/memspydriverobjectsshared.h> |
25 #include <memspy/driver/memspydriverenumerationsshared.h> |
25 #include <memspy/driver/memspydriverenumerationsshared.h> |
26 |
26 |
27 // User includes |
27 // User includes |
28 #include "MemSpyDriverObjectsInternal.h" |
28 #include "MemSpyDriverObjectsInternal.h" |
|
29 #include "MemSpyDriverOSAdaption.h" |
29 |
30 |
30 // Constants |
31 // Constants |
31 // We shouldn't be using any of these any more! -Tomsci |
32 // We shouldn't be using any of these any more! -Tomsci |
32 const TUint KRHeapObjectSize = 0x74; |
33 const TUint KRHeapObjectSize = 0x74; |
33 const TUint KRAllocatorAndRHeapMemberDataOffset = 4; // 4 bytes past start of allocator address, i.e. skipping the vtable |
34 const TUint KRAllocatorAndRHeapMemberDataOffset = 4; // 4 bytes past start of allocator address, i.e. skipping the vtable |
34 const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset; |
35 const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset; |
35 |
36 |
36 // Classes referenced |
37 // Classes referenced |
37 class DMemSpyDriverOSAdaption; |
|
38 namespace LtkUtils |
38 namespace LtkUtils |
39 { |
39 { |
40 class RAllocatorHelper; |
40 class RAllocatorHelper; |
41 } |
41 } |
42 |
42 |
56 public: // Virtual API |
56 public: // Virtual API |
57 virtual void Reset(); |
57 virtual void Reset(); |
58 virtual void Close(); |
58 virtual void Close(); |
59 virtual DChunk& Chunk() = 0; |
59 virtual DChunk& Chunk() = 0; |
60 virtual const DChunk& Chunk() const = 0; |
60 virtual const DChunk& Chunk() const = 0; |
|
61 virtual const TLinAddr ChunkBase() const = 0; |
61 |
62 |
62 protected: |
63 protected: |
63 LtkUtils::RAllocatorHelper* iHelper; |
64 LtkUtils::RAllocatorHelper* iHelper; |
64 }; |
65 }; |
65 |
|
66 |
|
67 |
|
68 |
|
69 class RMemSpyDriverRHeapReadFromCopy : public RMemSpyDriverRHeapBase |
|
70 { |
|
71 protected: |
|
72 RMemSpyDriverRHeapReadFromCopy( DMemSpyDriverOSAdaption& aOSAdaption ); |
|
73 |
|
74 public: // New API |
|
75 void AssociateWithKernelChunk( DChunk* aChunk, TLinAddr aAddress, TUint32 aMappingAttributes ); |
|
76 |
|
77 public: // From RMemSpyDriverRHeapBase |
|
78 void Reset(); |
|
79 DChunk& Chunk(); |
|
80 const DChunk& Chunk() const; |
|
81 |
|
82 protected: |
|
83 inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } |
|
84 |
|
85 private: |
|
86 DMemSpyDriverOSAdaption& iOSAdaption; |
|
87 |
|
88 // Copy of the client's heap data |
|
89 DChunk* iChunk; |
|
90 TLinAddr iChunkAddress; |
|
91 TUint32 iChunkMappingAttributes; |
|
92 |
|
93 // Calculated delta between client's address space values and actual kernel |
|
94 // address of the heap chunk. |
|
95 //TUint iClientToKernelDelta; |
|
96 }; |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
66 |
104 class RMemSpyDriverRHeapUser : public RMemSpyDriverRHeapBase |
67 class RMemSpyDriverRHeapUser : public RMemSpyDriverRHeapBase |
105 { |
68 { |
106 public: |
69 public: |
107 RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption ); |
70 RMemSpyDriverRHeapUser( DMemSpyDriverOSAdaption& aOSAdaption ); |
108 TInt OpenUserHeap(DThread& aThread, TBool aEuserUdeb); |
71 TInt OpenUserHeap(DThread& aThread, TBool aEuserUdeb); |
109 |
72 |
110 DChunk& Chunk() { return *iChunk; } |
73 DChunk& Chunk() { return *iChunk; } |
111 const DChunk& Chunk() const { return *iChunk; } |
74 const DChunk& Chunk() const { return *iChunk; } |
|
75 const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); } |
112 |
76 |
113 private: |
77 private: |
114 inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } |
78 inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } |
|
79 inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; } |
115 |
80 |
116 private: |
81 private: |
117 DMemSpyDriverOSAdaption& iOSAdaption; |
82 DMemSpyDriverOSAdaption& iOSAdaption; |
118 DChunk* iChunk; |
83 DChunk* iChunk; |
119 }; |
84 }; |
120 |
85 |
121 |
86 |
122 |
87 class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapBase |
123 class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapReadFromCopy |
|
124 { |
88 { |
125 public: |
89 public: |
126 RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption ); |
90 RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption ); |
127 |
91 |
128 public: // API |
92 public: // API |
129 void SetKernelHeap( RHeapK& aKernelHeap ); |
93 TInt AssociateWithKernelChunk( DChunk* aKernelChunk, DChunk* aCopiedChunk, TLinAddr aCopiedChunkBase, TInt aOffset ); |
|
94 TBool IsOpen(); |
130 |
95 |
131 public: // From RMemSpyDriverRHeapBase |
96 public: // From RMemSpyDriverRHeapBase |
132 //void DisassociateWithKernelChunk(); |
97 void Reset(); |
133 void Close(); |
98 void Close(); |
|
99 DChunk& Chunk(); |
|
100 const DChunk& Chunk() const; |
|
101 const TLinAddr ChunkBase() const { return iChunkBase; } |
134 |
102 |
135 private: |
103 private: |
136 RHeapK* iKernelHeap; |
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; |
137 }; |
113 }; |
138 |
|
139 |
114 |
140 |
115 |
141 class RMemSpyDriverRHeapKernelInPlace : public RMemSpyDriverRHeapBase |
116 class RMemSpyDriverRHeapKernelInPlace : public RMemSpyDriverRHeapBase |
142 { |
117 { |
143 public: |
118 public: |
144 RMemSpyDriverRHeapKernelInPlace(); |
119 RMemSpyDriverRHeapKernelInPlace( DMemSpyDriverOSAdaption& aOSAdaption ); |
145 TInt OpenKernelHeap(); |
120 TInt OpenKernelHeap(); |
146 |
121 |
147 |
122 |
148 public: // From RMemSpyDriverRHeapBase |
123 public: // From RMemSpyDriverRHeapBase |
149 void Close(); |
124 void Close(); |
150 |
125 |
151 DChunk& Chunk(); |
126 DChunk& Chunk(); |
152 const DChunk& Chunk() const; |
127 const DChunk& Chunk() const; |
|
128 const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); } |
153 |
129 |
154 // Only important member data is the base class's RAllocatorHelper |
|
155 // We do cache the chunk though |
|
156 private: |
130 private: |
|
131 inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } |
|
132 inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; } |
|
133 |
|
134 private: |
|
135 DMemSpyDriverOSAdaption& iOSAdaption; |
|
136 |
|
137 // Only important member data is the base class's RAllocatorHelper |
|
138 // We do cache the chunk though |
157 DChunk* iChunk; |
139 DChunk* iChunk; |
158 }; |
140 }; |
159 |
141 |
160 |
142 |
161 #endif |
143 #endif |