25 #include <u32std.h> |
25 #include <u32std.h> |
26 |
26 |
27 //user includes |
27 //user includes |
28 #include <memspy/engine/memspyprocessdata.h> //for Processes |
28 #include <memspy/engine/memspyprocessdata.h> //for Processes |
29 #include <memspy/api/memspyapiprocess.h> |
29 #include <memspy/api/memspyapiprocess.h> |
|
30 |
30 #include <memspy/engine/memspythreaddata.h> //for Threads |
31 #include <memspy/engine/memspythreaddata.h> //for Threads |
31 #include <memspy/api/memspyapithread.h> |
32 #include <memspy/api/memspyapithread.h> |
|
33 #include <memspy/api/memspyapithreadinfoitem.h> |
|
34 #include <memspy/engine/memspythreadinfoitemdata.h> |
|
35 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
36 |
32 #include <memspy/engine/memspykernelobjectdata.h> //for KernelObjects |
37 #include <memspy/engine/memspykernelobjectdata.h> //for KernelObjects |
33 #include <memspy/api/memspyapikernelobject.h> |
38 #include <memspy/api/memspyapikernelobject.h> |
|
39 |
34 #include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems |
40 #include <memspy/api/memspyapikernelobjectitem.h> //for KernelObjectItems |
|
41 |
35 #include <memspy/engine/memspyheapdata.h> //for Heap |
42 #include <memspy/engine/memspyheapdata.h> //for Heap |
36 #include <memspy/api/memspyapiheap.h> |
43 #include <memspy/api/memspyapiheap.h> |
37 |
44 |
|
45 #include <memspyengineclientinterface.h> |
|
46 |
38 // Constants |
47 // Constants |
39 const TInt KMemSpyVersion = 2; |
48 const TInt KMemSpyVersion = 2; |
40 |
|
41 // Literal constants |
|
42 _LIT( KMemSpyServer2, "MemSpyServer.exe" ); |
|
43 |
|
44 |
|
45 // |
|
46 enum TMemSpyOperations |
|
47 { |
|
48 //Output operations |
|
49 |
|
50 // EGetSinkType, |
|
51 // EOutputToDebug, |
|
52 // EOutputToFile, |
|
53 // EOutputKernelObjects, |
|
54 // ESetServerTimeOutStatus, |
|
55 // EOutputProcessInfo, |
|
56 |
|
57 //Processes operations |
|
58 |
|
59 EGetProcessCount, |
|
60 EGetProcesses, |
|
61 EGetThreadCount, |
|
62 EGetThreads, |
|
63 ESetThreadPriority, |
|
64 EProcessSystemPermanentOrCritical, |
|
65 EEndProcess, |
|
66 ESwitchToProcess, |
|
67 // EOpenCloseCurrentProcess |
|
68 |
|
69 //Threads operations |
|
70 EThreadSystemPermanentOrCritical, |
|
71 EEndThread, |
|
72 ESwitchToThread, |
|
73 |
|
74 //Kernel Objects operations |
|
75 EGetKernelObjectTypeCount, |
|
76 EGetKernelObjects, |
|
77 EGetKernelObjectItemsCount, |
|
78 EGetKernelObjectItems, |
|
79 //EOutputKernelObjects |
|
80 |
|
81 //Heap operations |
|
82 EGetHeap |
|
83 }; |
|
84 |
49 |
85 enum TSortType |
50 enum TSortType |
86 { |
51 { |
87 ESortProcById, |
52 ESortProcById, |
88 ESortProcByName, |
53 ESortProcByName, |
90 ESortProcByCodeSegs, |
55 ESortProcByCodeSegs, |
91 ESortProcByHeapUsage, |
56 ESortProcByHeapUsage, |
92 ESortProcByStackUsage |
57 ESortProcByStackUsage |
93 }; |
58 }; |
94 |
59 |
95 enum TEndType |
60 enum TMemSpyOutputType |
96 { |
61 { |
97 ETerminate, |
62 EOutputTypeDebug = 0, |
98 EKill, |
63 EOutputTypeFile |
99 EPanic |
64 }; |
100 }; |
65 |
101 |
66 |
102 NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase |
67 NONSHARABLE_CLASS( RMemSpySession ) : public RSessionBase |
103 { |
68 { |
104 public: |
69 public: |
105 IMPORT_C RMemSpySession(); |
70 IMPORT_C RMemSpySession(); |
106 IMPORT_C TInt Connect(); |
71 IMPORT_C TInt Connect(); |
107 |
72 |
108 public: //API |
73 public: //API |
109 //Output operations |
74 IMPORT_C void OutputKernelHeapDataL(TMemSpyOutputType aOutputType); //EMemSpyClientServerOpHeapData |
110 //inline TMemSpySinkType GetSinkType(); |
75 IMPORT_C void OutputThreadHeapDataL(TMemSpyOutputType aOutputType, TThreadId aThreadId); //EMemSpyClientServerOpHeapData |
111 //inline void OutputToDebug(); |
76 IMPORT_C void OutputThreadCellListL(TMemSpyOutputType aOutputType, TThreadId aThreadId);//EMemSpyClientServerOpHeapCellListing |
112 //inline void OutputToFile(); |
77 IMPORT_C void OutputKernelObjectsL(TMemSpyOutputType aOutputType);// EMemSpyClientServerOpEnumerateKernelContainerAll |
113 //inline void OutputKernelObjects(); |
78 IMPORT_C void OutputCompactStackInfoL(TMemSpyOutputType aOutputType);// EMemSpyClientServerOpStackInfoCompact |
114 //inline void SetServerTimeOutStatus( TUint32 aValue, TBool aEnabled ); |
79 IMPORT_C void OutputCompactHeapInfoL(TMemSpyOutputType aOutputType);// EMemSpyClientServerOpHeapInfoCompact |
115 //inline void OutputProcessInfo( TMemSpyProcess aProcess ); |
|
116 |
80 |
117 //Processes operations |
81 IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById); |
118 /** |
82 |
119 * |
83 IMPORT_C TProcessId GetProcessIdByNameL(const TDesC& aProcessName); |
120 */ |
|
121 IMPORT_C void GetProcessesL(RArray<CMemSpyApiProcess*> &aProcesses, TSortType aSortType = ESortProcById); |
|
122 |
84 |
123 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById); |
85 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiThread*> &aThreads, TSortType aSortType = ESortProcById); |
|
86 |
124 IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value |
87 IMPORT_C TInt ProcessSystemPermanentOrCritical( TProcessId aId, TBool aValue ); //aValue -> return value |
125 |
88 |
126 IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority); |
89 IMPORT_C void SetThreadPriorityL(TThreadId aId, TInt aPriority); |
127 IMPORT_C TInt EndProcess( TProcessId aId, TEndType aType ); |
90 IMPORT_C TInt EndProcess( TProcessId aId, TMemSpyEndType aType ); |
128 |
91 |
129 IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought ); |
92 IMPORT_C TInt SwitchToProcess( TProcessId aId, TBool aBrought ); |
130 |
93 |
131 //inline void OpenCloseCurrentProcess( TProcessId aId, TBool aOpen ); |
|
132 |
94 |
133 //Threads operations |
95 //Threads operations |
134 /** |
96 /** |
135 * |
97 * |
136 */ |
98 */ |
137 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById); |
99 IMPORT_C void GetThreadsL(TProcessId aProcessId, RArray<CMemSpyApiProcess*> &aThreads, TSortType aSortType = ESortProcById); |
138 |
100 |
139 IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue ); |
101 IMPORT_C TInt ThreadSystemPermanentOrCritical( TThreadId aId, TBool aValue ); |
140 |
102 |
141 IMPORT_C TInt EndThread( TThreadId aId, TEndType aType ); |
103 IMPORT_C TInt EndThread( TThreadId aId, TMemSpyEndType aType ); |
142 |
104 |
143 IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought ); |
105 IMPORT_C TInt SwitchToThread( TThreadId aId, TBool aBrought ); |
|
106 |
|
107 IMPORT_C TInt GetInfoItemType( TInt aIndex, TThreadId aId, TMemSpyThreadInfoItemType &aType ); |
|
108 |
|
109 IMPORT_C void GetThreadInfoItems( RArray<CMemSpyApiThreadInfoItem*> &aInfoItems, TThreadId aId, TMemSpyThreadInfoItemType aType ); |
144 |
110 |
145 //KernelObjects operations |
111 //KernelObjects operations |
146 /** |
112 /** |
147 * |
113 * |
148 */ |
114 */ |
149 IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects ); |
115 IMPORT_C TInt GetKernelObjects( RArray<CMemSpyApiKernelObject*> &aKernelObjects ); |
150 |
116 |
151 IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ); |
117 IMPORT_C TInt GetKernelObjectItems( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ); |
152 |
118 |
|
119 IMPORT_C void OutputAllContainerContents(); |
|
120 |
153 /** |
121 /** |
154 * |
122 * |
155 */ |
123 */ |
156 //IMPORT_C TInt GetHeap( RArray<CMemSpyApiHeap*> &aHeap ); |
|
157 //IMPORT_C TInt GetHeap( CMemSpyApiHeap* aHeap ); |
|
158 IMPORT_C CMemSpyApiHeap* GetHeap(); |
124 IMPORT_C CMemSpyApiHeap* GetHeap(); |
|
125 |
|
126 IMPORT_C void DumpKernelHeap(); |
159 |
127 |
160 private: |
128 private: |
161 TInt StartServer(); |
129 TInt StartServer(); |
|
130 |
|
131 void SetOutputTypeL(TMemSpyOutputType aOutputType); |
162 }; |
132 }; |
163 |
133 |
164 #endif // MEMSPYSESSION_H |
134 #endif // MEMSPYSESSION_H |