|
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 #include "ConsoleMenu.h" |
|
19 |
|
20 // System includes |
|
21 #include <e32debug.h> |
|
22 |
|
23 // Engine includes |
|
24 #include <memspyengineclientinterface.h> |
|
25 #include <memspy/engine/memspyengine.h> |
|
26 #include <memspy/engine/memspyenginehelperheap.h> |
|
27 #include <memspy/engine/memspyengineoutputsink.h> |
|
28 #include <memspy/engine/memspyenginehelperstack.h> |
|
29 #include <memspy/engine/memspyengineobjectthread.h> |
|
30 #include <memspy/engine/memspyengineobjectprocess.h> |
|
31 #include <memspy/engine/memspydevicewideoperations.h> |
|
32 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
33 #include <memspy/engine/memspyenginehelperkernelcontainers.h> |
|
34 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
35 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
|
36 |
|
37 // User includes |
|
38 #include "ConsoleConstants.h" |
|
39 #include "ConsoleDWOperation.h" |
|
40 |
|
41 |
|
42 CMemSpyConsoleMenu::CMemSpyConsoleMenu( CMemSpyEngine& aEngine, CConsoleBase& aConsole ) |
|
43 : CActive( EPriorityHigh ), iEngine( aEngine ), iConsole( aConsole ) |
|
44 { |
|
45 CActiveScheduler::Add( this ); |
|
46 iEngine.SetObserver( this ); |
|
47 } |
|
48 |
|
49 |
|
50 CMemSpyConsoleMenu::~CMemSpyConsoleMenu() |
|
51 { |
|
52 Cancel(); |
|
53 iEngine.SetObserver( NULL ); |
|
54 } |
|
55 |
|
56 |
|
57 void CMemSpyConsoleMenu::ConstructL() |
|
58 { |
|
59 DrawMenuL(); |
|
60 WaitForInput(); |
|
61 } |
|
62 |
|
63 |
|
64 CMemSpyConsoleMenu* CMemSpyConsoleMenu::NewLC( CMemSpyEngine& aEngine, CConsoleBase& aConsole ) |
|
65 { |
|
66 CMemSpyConsoleMenu* self = new(ELeave) CMemSpyConsoleMenu( aEngine, aConsole ); |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 return self; |
|
70 } |
|
71 |
|
72 |
|
73 void CMemSpyConsoleMenu::DrawMenuL() |
|
74 { |
|
75 iConsole.ClearScreen(); |
|
76 |
|
77 // First line - sink type (defaults to file) |
|
78 _LIT( KLine1, "1 or T. Toggle output mode between file or trace [%S]" ); |
|
79 if ( iEngine.SinkType() == ESinkTypeDebug ) |
|
80 { |
|
81 _LIT( KLine1Trace, "Trace" ); |
|
82 iConsole.Printf( KLine1, &KLine1Trace ); |
|
83 } |
|
84 else |
|
85 { |
|
86 _LIT( KLine1File, "File" ); |
|
87 iConsole.Printf( KLine1, &KLine1File ); |
|
88 } |
|
89 iConsole.Write( KMemSpyConsoleNewLine ); |
|
90 |
|
91 // Kernel heap dump |
|
92 _LIT( KLine2, "2 or K. Dump kernel heap data" ); |
|
93 iConsole.Write( KLine2 ); |
|
94 iConsole.Write( KMemSpyConsoleNewLine ); |
|
95 |
|
96 // Kernel heap dump |
|
97 _LIT( KLine3, "3 or O. Dump kernel object listing" ); |
|
98 iConsole.Write( KLine3 ); |
|
99 iConsole.Write( KMemSpyConsoleNewLine ); |
|
100 |
|
101 // Heap (CSV) listing |
|
102 _LIT( KLine4, "4 or H. Heap CSV-information (for all threads)" ); |
|
103 iConsole.Write( KLine4 ); |
|
104 iConsole.Write( KMemSpyConsoleNewLine ); |
|
105 |
|
106 // Stack (CSV) listing |
|
107 _LIT( KLine5, "5 or S. Stack CSV-information (for all threads)" ); |
|
108 iConsole.Write( KLine5 ); |
|
109 iConsole.Write( KMemSpyConsoleNewLine ); |
|
110 |
|
111 // Heap data |
|
112 _LIT( KLine6, "6 or D. Get heap data for a user-thread" ); |
|
113 iConsole.Write( KLine6 ); |
|
114 iConsole.Write( KMemSpyConsoleNewLine ); |
|
115 |
|
116 // Heap cell listing |
|
117 _LIT( KLine7, "7 or L. Get heap cell list for a user-thread" ); |
|
118 iConsole.Write( KLine7 ); |
|
119 iConsole.Write( KMemSpyConsoleNewLine ); |
|
120 |
|
121 // Exit key |
|
122 _LIT( KLine8, "8 or X. Exit" ); |
|
123 iConsole.Write( KLine8 ); |
|
124 iConsole.Write( KMemSpyConsoleNewLine ); |
|
125 |
|
126 // Spacer |
|
127 iConsole.Write( KMemSpyConsoleNewLine ); |
|
128 iConsole.Write( KMemSpyConsoleNewLine ); |
|
129 |
|
130 // Status message |
|
131 iStatusMessagePos = iConsole.CursorPos(); |
|
132 RedrawStatusMessage(); |
|
133 |
|
134 // Spacer |
|
135 iConsole.Write( KMemSpyConsoleNewLine ); |
|
136 |
|
137 // Show input prompt. |
|
138 iCommandPromptPos = iConsole.CursorPos(); |
|
139 RedrawInputPrompt(); |
|
140 } |
|
141 |
|
142 |
|
143 void CMemSpyConsoleMenu::WaitForInput() |
|
144 { |
|
145 ASSERT( !IsActive() ); |
|
146 iConsole.Read( iStatus ); |
|
147 SetActive(); |
|
148 } |
|
149 |
|
150 |
|
151 void CMemSpyConsoleMenu::RunL() |
|
152 { |
|
153 TKeyCode key = iConsole.KeyCode(); |
|
154 // |
|
155 #ifdef _DEBUG |
|
156 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - START - key = %d", key ); |
|
157 #endif |
|
158 // |
|
159 if ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter ) |
|
160 { |
|
161 TRAP_IGNORE( ProcessCommandBufferL() ); |
|
162 } |
|
163 else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel ) |
|
164 { |
|
165 ClearCommandBuffer(); |
|
166 RedrawInputPrompt(); |
|
167 } |
|
168 else if ( key == EKeyBackspace ) |
|
169 { |
|
170 const TInt cmdBufLength = iCommandBuffer.Length(); |
|
171 if ( cmdBufLength > 0 ) |
|
172 { |
|
173 iCommandBuffer.SetLength( cmdBufLength - 1 ); |
|
174 RedrawInputPrompt(); |
|
175 } |
|
176 } |
|
177 else |
|
178 { |
|
179 TChar character( key ); |
|
180 if ( character.IsPrint() ) |
|
181 { |
|
182 if ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() ) |
|
183 { |
|
184 iCommandBuffer.Append( TChar( key ) ); |
|
185 } |
|
186 |
|
187 RedrawInputPrompt(); |
|
188 } |
|
189 } |
|
190 |
|
191 WaitForInput(); |
|
192 |
|
193 #ifdef _DEBUG |
|
194 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::RunL() - END" ); |
|
195 #endif |
|
196 } |
|
197 |
|
198 |
|
199 void CMemSpyConsoleMenu::DoCancel() |
|
200 { |
|
201 iConsole.ReadCancel(); |
|
202 } |
|
203 |
|
204 |
|
205 void CMemSpyConsoleMenu::OnCmdSinkTypeToggleL() |
|
206 { |
|
207 if ( iEngine.SinkType() == ESinkTypeDebug ) |
|
208 { |
|
209 iEngine.InstallSinkL( ESinkTypeFile ); |
|
210 } |
|
211 else |
|
212 { |
|
213 iEngine.InstallSinkL( ESinkTypeDebug ); |
|
214 } |
|
215 } |
|
216 |
|
217 |
|
218 void CMemSpyConsoleMenu::OnCmdHeapDataKernelL() |
|
219 { |
|
220 #ifdef _DEBUG |
|
221 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataKernelL() - START" ); |
|
222 #endif |
|
223 |
|
224 _LIT( KMsg, "Ouputting Kernel data..." ); |
|
225 RedrawStatusMessage( KMsg ); |
|
226 |
|
227 iEngine.HelperHeap().OutputHeapDataKernelL(); |
|
228 |
|
229 RedrawStatusMessage( KNullDesC ); |
|
230 } |
|
231 |
|
232 |
|
233 void CMemSpyConsoleMenu::OnCmdKernelObjectListingL() |
|
234 { |
|
235 #ifdef _DEBUG |
|
236 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdKernelObjectListingL() - START" ); |
|
237 #endif |
|
238 |
|
239 _LIT( KMsg, "Ouputting Kernel Object listing..." ); |
|
240 RedrawStatusMessage( KMsg ); |
|
241 // |
|
242 CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers(); |
|
243 CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL(); |
|
244 CleanupStack::PushL( model ); |
|
245 // |
|
246 CMemSpyEngineOutputSink& sink = iEngine.Sink(); |
|
247 model->OutputL( sink ); |
|
248 // |
|
249 CleanupStack::PopAndDestroy( model ); |
|
250 |
|
251 RedrawStatusMessage( KNullDesC ); |
|
252 } |
|
253 |
|
254 |
|
255 void CMemSpyConsoleMenu::OnCmdCSVListingStackL() |
|
256 { |
|
257 #ifdef _DEBUG |
|
258 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingStackL() - START" ); |
|
259 #endif |
|
260 |
|
261 iEngine.HelperStack().OutputStackInfoForDeviceL(); |
|
262 } |
|
263 |
|
264 |
|
265 void CMemSpyConsoleMenu::OnCmdCSVListingHeapL() |
|
266 { |
|
267 #ifdef _DEBUG |
|
268 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdCSVListingHeapL() - START" ); |
|
269 #endif |
|
270 |
|
271 iEngine.HelperHeap().OutputHeapInfoForDeviceL(); |
|
272 } |
|
273 |
|
274 |
|
275 void CMemSpyConsoleMenu::OnCmdHeapDataUserL() |
|
276 { |
|
277 #ifdef _DEBUG |
|
278 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START" ); |
|
279 #endif |
|
280 |
|
281 GetProcessName(); |
|
282 |
|
283 // Work out what to do. |
|
284 iCommandBuffer.Trim(); |
|
285 |
|
286 #ifdef _DEBUG |
|
287 RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - requested dump heap for proc: %S"), &iCommandBuffer ); |
|
288 #endif |
|
289 |
|
290 if ( iCommandBuffer.Length() > 0 ) |
|
291 { |
|
292 iConsole.Write( KMemSpyConsoleNewLine ); |
|
293 iConsole.Write( KMemSpyConsoleNewLine ); |
|
294 // |
|
295 HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 ); |
|
296 TPtr pCmdBuf( cmdBuf->Des() ); |
|
297 pCmdBuf.Copy( iCommandBuffer ); |
|
298 pCmdBuf.Append( KMemSpyConsoleWildcardCharacter ); |
|
299 // |
|
300 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
|
301 const TInt count = container.Count(); |
|
302 TFullName fullThreadName; |
|
303 // |
|
304 TInt index = 0; |
|
305 #ifdef _DEBUG |
|
306 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - procCount: %d", count ); |
|
307 #endif |
|
308 |
|
309 while( index < count ) |
|
310 { |
|
311 CMemSpyProcess& process = container.At( index ); |
|
312 const TPtrC processName( process.Name() ); |
|
313 #ifdef _DEBUG |
|
314 RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - procName: 0x%08x %S"), &process, &processName ); |
|
315 #endif |
|
316 |
|
317 // |
|
318 if ( processName.MatchF( pCmdBuf ) >= 0 ) |
|
319 { |
|
320 _LIT( KProcessingRequest, "** Dumping Heap Data for thread: %S" ); |
|
321 const TInt threadCount = process.Count(); |
|
322 for( TInt i=0; i<threadCount; i++ ) |
|
323 { |
|
324 CMemSpyThread& thread = process.At( i ); |
|
325 // |
|
326 fullThreadName = thread.FullName(); |
|
327 iConsole.Printf( KProcessingRequest, &fullThreadName ); |
|
328 iConsole.Write( KMemSpyConsoleNewLine ); |
|
329 // |
|
330 TRAP_IGNORE( iEngine.HelperHeap().OutputHeapDataUserL( thread ) ); |
|
331 } |
|
332 |
|
333 break; |
|
334 } |
|
335 |
|
336 ++index; |
|
337 } |
|
338 |
|
339 CleanupStack::PopAndDestroy( cmdBuf ); |
|
340 DrawMenuL(); |
|
341 } |
|
342 else |
|
343 { |
|
344 // Bad user data entry |
|
345 DrawMenuL(); |
|
346 _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" ); |
|
347 RedrawStatusMessage( KInvalidEntry ); |
|
348 RedrawInputPrompt(); |
|
349 } |
|
350 } |
|
351 |
|
352 |
|
353 void CMemSpyConsoleMenu::OnCmdHeapCellListUserL() |
|
354 { |
|
355 #ifdef _DEBUG |
|
356 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapCellListUserL() - START" ); |
|
357 #endif |
|
358 |
|
359 GetProcessName(); |
|
360 |
|
361 // Work out what to do. |
|
362 iCommandBuffer.Trim(); |
|
363 if ( iCommandBuffer.Length() > 0 ) |
|
364 { |
|
365 iConsole.Write( KMemSpyConsoleNewLine ); |
|
366 iConsole.Write( KMemSpyConsoleNewLine ); |
|
367 // |
|
368 HBufC* cmdBuf = HBufC::NewLC( KMemSpyMaxInputBufferLength + 10 ); |
|
369 TPtr pCmdBuf( cmdBuf->Des() ); |
|
370 pCmdBuf.Copy( iCommandBuffer ); |
|
371 pCmdBuf.Append( KMemSpyConsoleWildcardCharacter ); |
|
372 // |
|
373 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
|
374 const TInt count = container.Count(); |
|
375 TFullName fullThreadName; |
|
376 // |
|
377 TInt index = 0; |
|
378 while( index < count ) |
|
379 { |
|
380 CMemSpyProcess& process = container.At( index ); |
|
381 const TPtrC processName( process.Name() ); |
|
382 // |
|
383 if ( processName.MatchF( pCmdBuf ) >= 0 ) |
|
384 { |
|
385 _LIT( KProcessingRequest, "** Dumping Heap Cell List for thread: %S" ); |
|
386 const TInt threadCount = process.Count(); |
|
387 for( TInt i=0; i<threadCount; i++ ) |
|
388 { |
|
389 CMemSpyThread& thread = process.At( i ); |
|
390 // |
|
391 fullThreadName = thread.FullName(); |
|
392 iConsole.Printf( KProcessingRequest, &fullThreadName ); |
|
393 iConsole.Write( KMemSpyConsoleNewLine ); |
|
394 // |
|
395 TRAP_IGNORE( iEngine.HelperHeap().OutputCellListingUserL( thread ) ); |
|
396 } |
|
397 |
|
398 break; |
|
399 } |
|
400 |
|
401 ++index; |
|
402 } |
|
403 |
|
404 CleanupStack::PopAndDestroy( cmdBuf ); |
|
405 DrawMenuL(); |
|
406 } |
|
407 else |
|
408 { |
|
409 // Bad user data entry |
|
410 DrawMenuL(); |
|
411 _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" ); |
|
412 RedrawStatusMessage( KInvalidEntry ); |
|
413 RedrawInputPrompt(); |
|
414 } |
|
415 } |
|
416 |
|
417 |
|
418 void CMemSpyConsoleMenu::ClearCommandBuffer() |
|
419 { |
|
420 iCommandBuffer.Zero(); |
|
421 } |
|
422 |
|
423 |
|
424 void CMemSpyConsoleMenu::ProcessCommandBufferL() |
|
425 { |
|
426 iCommandBuffer.Trim(); |
|
427 // |
|
428 #ifdef _DEBUG |
|
429 RDebug::Print( _L("[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - cmd: [%S]"), &iCommandBuffer ); |
|
430 #endif |
|
431 // |
|
432 TBool validCommand = EFalse; |
|
433 if ( iCommandBuffer.Length() == 1 ) |
|
434 { |
|
435 // Reset if not recognised... |
|
436 validCommand = ETrue; |
|
437 |
|
438 const TChar cmd = iCommandBuffer[ 0 ]; |
|
439 switch( cmd ) |
|
440 { |
|
441 case '1': |
|
442 case 't': |
|
443 case 'T': |
|
444 OnCmdSinkTypeToggleL(); |
|
445 break; |
|
446 case '2': |
|
447 case 'k': |
|
448 case 'K': |
|
449 OnCmdHeapDataKernelL(); |
|
450 break; |
|
451 case '3': |
|
452 case 'o': |
|
453 case 'O': |
|
454 OnCmdKernelObjectListingL(); |
|
455 break; |
|
456 case '4': |
|
457 case 'h': |
|
458 case 'H': |
|
459 OnCmdCSVListingHeapL(); |
|
460 break; |
|
461 case '5': |
|
462 case 's': |
|
463 case 'S': |
|
464 OnCmdCSVListingStackL(); |
|
465 break; |
|
466 case '6': |
|
467 case 'd': |
|
468 case 'D': |
|
469 OnCmdHeapDataUserL(); |
|
470 break; |
|
471 case '7': |
|
472 case 'l': |
|
473 case 'L': |
|
474 OnCmdHeapCellListUserL(); |
|
475 break; |
|
476 case '8': |
|
477 case 'x': |
|
478 case 'X': |
|
479 CActiveScheduler::Stop(); |
|
480 return; // NB: avoid redrawing menu when exiting |
|
481 |
|
482 default: |
|
483 validCommand = EFalse; |
|
484 break; |
|
485 } |
|
486 } |
|
487 // |
|
488 ClearCommandBuffer(); |
|
489 // |
|
490 if ( !validCommand ) |
|
491 { |
|
492 _LIT( KInvalidEntry, "*** ERROR - Invalid Command ***" ); |
|
493 RedrawStatusMessage( KInvalidEntry ); |
|
494 RedrawInputPrompt(); |
|
495 } |
|
496 else |
|
497 { |
|
498 DrawMenuL(); |
|
499 } |
|
500 |
|
501 #ifdef _DEBUG |
|
502 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::ProcessCommandBufferL() - END" ); |
|
503 #endif |
|
504 } |
|
505 |
|
506 |
|
507 void CMemSpyConsoleMenu::RedrawInputPrompt() |
|
508 { |
|
509 iConsole.SetCursorPosAbs( iCommandPromptPos ); |
|
510 iConsole.ClearToEndOfLine(); |
|
511 iConsole.Printf( KMemSpyConsoleInputPrompt, &iCommandBuffer ); |
|
512 } |
|
513 |
|
514 |
|
515 void CMemSpyConsoleMenu::RedrawStatusMessage() |
|
516 { |
|
517 RedrawStatusMessage( KNullDesC ); |
|
518 } |
|
519 |
|
520 |
|
521 void CMemSpyConsoleMenu::RedrawStatusMessage( const TDesC& aMessage ) |
|
522 { |
|
523 iConsole.SetCursorPosAbs( iStatusMessagePos ); |
|
524 iConsole.ClearToEndOfLine(); |
|
525 iConsole.Write( aMessage ); |
|
526 iConsole.Write( KMemSpyConsoleNewLine ); |
|
527 } |
|
528 |
|
529 |
|
530 void CMemSpyConsoleMenu::GetProcessName() |
|
531 { |
|
532 iConsole.ClearScreen(); |
|
533 |
|
534 _LIT( KPromptMessage1, "Enter the full or partial process name" ); |
|
535 iConsole.Write( KPromptMessage1 ); |
|
536 iConsole.Write( KMemSpyConsoleNewLine ); |
|
537 _LIT( KPromptMessage2, "of the process that you are interested in." ); |
|
538 iConsole.Write( KPromptMessage2 ); |
|
539 iConsole.Write( KMemSpyConsoleNewLine ); |
|
540 _LIT( KPromptMessage3, "Press \'enter\' when done." ); |
|
541 iConsole.Write( KPromptMessage3 ); |
|
542 iConsole.Write( KMemSpyConsoleNewLine ); |
|
543 // |
|
544 ClearCommandBuffer(); |
|
545 iConsole.Write( KMemSpyConsoleNewLine ); |
|
546 iCommandPromptPos = iConsole.CursorPos(); |
|
547 RedrawInputPrompt(); |
|
548 // |
|
549 TBool done = EFalse; |
|
550 while( !done ) |
|
551 { |
|
552 // Get a key |
|
553 const TKeyCode key = iConsole.Getch(); |
|
554 |
|
555 // Process it |
|
556 #ifdef _DEBUG |
|
557 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::OnCmdHeapDataUserL() - START - key = %d", key ); |
|
558 #endif |
|
559 // |
|
560 if ( key == EKeyEnter || key == KMemSpyUiS60KeyCodeButtonOk || key == KMemSpyUiS60KeyCodeRockerEnter ) |
|
561 { |
|
562 done = ETrue; |
|
563 } |
|
564 else if ( key == EKeyEscape || key == KMemSpyUiS60KeyCodeButtonCancel ) |
|
565 { |
|
566 ClearCommandBuffer(); |
|
567 done = ETrue; |
|
568 } |
|
569 else if ( key == EKeyBackspace ) |
|
570 { |
|
571 const TInt cmdBufLength = iCommandBuffer.Length(); |
|
572 if ( cmdBufLength > 0 ) |
|
573 { |
|
574 iCommandBuffer.SetLength( cmdBufLength - 1 ); |
|
575 RedrawInputPrompt(); |
|
576 } |
|
577 } |
|
578 else |
|
579 { |
|
580 TChar character( key ); |
|
581 if ( character.IsPrint() ) |
|
582 { |
|
583 if ( iCommandBuffer.Length() < iCommandBuffer.MaxLength() ) |
|
584 { |
|
585 iCommandBuffer.Append( TChar( key ) ); |
|
586 } |
|
587 |
|
588 RedrawInputPrompt(); |
|
589 } |
|
590 } |
|
591 } |
|
592 } |
|
593 |
|
594 |
|
595 void CMemSpyConsoleMenu::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext ) |
|
596 { |
|
597 if ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest ) |
|
598 { |
|
599 const TInt function = reinterpret_cast< TInt >( aContext ); |
|
600 InitiateMemSpyClientServerOperationL( function ); |
|
601 } |
|
602 } |
|
603 |
|
604 |
|
605 void CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL( TInt aOpCode ) |
|
606 { |
|
607 #ifdef _DEBUG |
|
608 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d, iRunningDeviceWideOperation: %d", aOpCode, iRunningDeviceWideOperation ); |
|
609 #endif |
|
610 // |
|
611 if ( aOpCode == EMemSpyClientServerOpExit ) |
|
612 { |
|
613 // Exit console app UI |
|
614 CActiveScheduler::Stop(); |
|
615 } |
|
616 else |
|
617 { |
|
618 CMemSpyDeviceWideOperations::TOperation op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary; |
|
619 switch( aOpCode ) |
|
620 { |
|
621 case EMemSpyClientServerOpSummaryInfo: |
|
622 op = CMemSpyDeviceWideOperations::EPerEntityGeneralSummary; |
|
623 break; |
|
624 case EMemSpyClientServerOpSummaryInfoDetailed: |
|
625 op = CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed; |
|
626 break; |
|
627 // |
|
628 case EMemSpyClientServerOpHeapInfo: |
|
629 op = CMemSpyDeviceWideOperations::EPerEntityHeapInfo; |
|
630 break; |
|
631 case EMemSpyClientServerOpHeapCellListing: |
|
632 op = CMemSpyDeviceWideOperations::EPerEntityHeapCellListing; |
|
633 break; |
|
634 case EMemSpyClientServerOpHeapData: |
|
635 op = CMemSpyDeviceWideOperations::EPerEntityHeapData; |
|
636 break; |
|
637 // |
|
638 case EMemSpyClientServerOpStackInfo: |
|
639 op = CMemSpyDeviceWideOperations::EPerEntityStackInfo; |
|
640 break; |
|
641 case EMemSpyClientServerOpStackDataUser: |
|
642 op = CMemSpyDeviceWideOperations::EPerEntityStackDataUser; |
|
643 break; |
|
644 case EMemSpyClientServerOpStackDataKernel: |
|
645 op = CMemSpyDeviceWideOperations::EPerEntityStackDataKernel; |
|
646 break; |
|
647 |
|
648 // These are not supported by the console UI |
|
649 default: |
|
650 case EMemSpyClientServerOpBitmapsSave: |
|
651 case EMemSpyClientServerOpSendToBackground: |
|
652 case EMemSpyClientServerOpBringToForeground: |
|
653 User::Leave( KErrNotSupported ); |
|
654 break; |
|
655 } |
|
656 |
|
657 if ( iRunningDeviceWideOperation ) |
|
658 { |
|
659 User::Leave( KErrInUse ); |
|
660 } |
|
661 else |
|
662 { |
|
663 iRunningDeviceWideOperation = ETrue; |
|
664 TRAP_IGNORE( CMemSpyDeviceWideOperationWaiter::ExecuteLD( iEngine, op ) ); |
|
665 iRunningDeviceWideOperation = EFalse; |
|
666 } |
|
667 } |
|
668 |
|
669 #ifdef _DEBUG |
|
670 RDebug::Printf( "[MCon] CMemSpyConsoleMenu::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode ); |
|
671 #endif |
|
672 } |
|
673 |
|
674 |
|
675 |