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 MEMSPYDRIVERLOGICALCHANHEAPWALK_H |
|
19 #define MEMSPYDRIVERLOGICALCHANHEAPWALK_H |
|
20 |
|
21 // System includes |
|
22 #include <e32cmn.h> |
|
23 #include <kern_priv.h> |
|
24 #ifdef __MARM__ |
|
25 #include <arm.h> |
|
26 #endif |
|
27 #include <memspy/driver/memspydriverobjectsshared.h> |
|
28 #include <memspy/driver/memspydriverenumerationsshared.h> |
|
29 |
|
30 // User includes |
|
31 #include "MemSpyDriverOpCodes.h" |
|
32 #include "MemSpyDriverHeapWalker.h" |
|
33 #include "MemSpyDriverObjectsInternal.h" |
|
34 #include "MemSpyDriverLogChanHeapBase.h" |
|
35 #include "MemSpyDriverEnumerationsInternal.h" |
|
36 |
|
37 // Classes referenced |
|
38 class DMemSpyDriverDevice; |
|
39 class TMemSpyDriverLogChanHeapWalkObserver; |
|
40 |
|
41 |
|
42 class DMemSpyDriverLogChanHeapWalk : public DMemSpyDriverLogChanHeapBase |
|
43 { |
|
44 public: |
|
45 DMemSpyDriverLogChanHeapWalk( DMemSpyDriverDevice& aDevice, DThread& aThread ); |
|
46 ~DMemSpyDriverLogChanHeapWalk(); |
|
47 |
|
48 private: // from DMemSpyDriverLogChanBase |
|
49 TInt Request( TInt aFunction, TAny* a1, TAny* a2 ); |
|
50 TBool IsHandler( TInt aFunction ) const; |
|
51 |
|
52 private: // Channel operation handlers |
|
53 TInt WalkHeapInit( TMemSpyDriverInternalWalkHeapParamsInit* aParams ); |
|
54 TInt WalkHeapNextCell( TUint aTid, TMemSpyDriverInternalWalkHeapParamsCell* aParams ); |
|
55 TInt WalkHeapClose(); |
|
56 TInt WalkHeapReadCellData( TMemSpyDriverInternalWalkHeapCellDataReadParams* aParams); |
|
57 TInt WalkHeapGetCellInfo( TAny* aCellAddress, TMemSpyDriverInternalWalkHeapParamsCell* aParams ); |
|
58 |
|
59 private: // Internal methods |
|
60 const TMemSpyDriverInternalWalkHeapParamsCell* CellInfoForAddressWithinCellRange( TAny* aAddress ) const; |
|
61 const TMemSpyDriverInternalWalkHeapParamsCell* CellInfoForSpecificAddress( TAny* aAddress ) const; |
|
62 |
|
63 private: // Heap walker callback |
|
64 TBool WalkerHandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber ); |
|
65 |
|
66 private: |
|
67 TBool iHeapWalkInitialised; |
|
68 TInt iWalkHeapCellIndex; |
|
69 RMemSpyDriverRHeapUser iWalkHeap; |
|
70 RArray< TMemSpyDriverInternalWalkHeapParamsCell > iWalkHeapCells; |
|
71 TMemSpyDriverInternalWalkHeapParamsInit iHeapWalkInitialParameters; |
|
72 |
|
73 private: |
|
74 friend class TMemSpyDriverLogChanHeapWalkObserver; |
|
75 }; |
|
76 |
|
77 |
|
78 class TMemSpyDriverLogChanHeapWalkObserver : public MMemSpyHeapWalkerObserver |
|
79 { |
|
80 public: |
|
81 inline TMemSpyDriverLogChanHeapWalkObserver( DMemSpyDriverLogChanHeapWalk& aChannel ) |
|
82 : iChannel( aChannel ) |
|
83 { |
|
84 } |
|
85 |
|
86 public: // From MHeapWalkerObserver |
|
87 void HandleHeapWalkInit() { } |
|
88 TBool HandleHeapCell(TMemSpyDriverCellType aCellType, TAny* aCellAddress, TInt aLength, TInt aNestingLevel, TInt aAllocNumber ) |
|
89 { |
|
90 return iChannel.WalkerHandleHeapCell( aCellType, aCellAddress, aLength, aNestingLevel, aAllocNumber ); |
|
91 } |
|
92 |
|
93 private: |
|
94 DMemSpyDriverLogChanHeapWalk& iChannel; |
|
95 }; |
|
96 |
|
97 |
|
98 |
|
99 #endif |
|