|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #include <eiktxlbm.h> //CTextListBoxModel |
|
18 |
|
19 #include <eiklbv.h> // CListBoxView |
|
20 #include <e32std.h> |
|
21 |
|
22 #include "coredumpui.h" |
|
23 //#include <tefexportconst.h> |
|
24 //#include <e32def.h> |
|
25 |
|
26 #ifndef HW |
|
27 #include <formatterapi.h> |
|
28 #include <crashdatasave.h> |
|
29 #include <optionconfig.h> |
|
30 |
|
31 #endif |
|
32 |
|
33 const TInt TObservationRequest::iOffset= _FOFF(TObservationRequest, iLink); |
|
34 |
|
35 void CResourceList::ConstructL(TInt aTablePosition) |
|
36 { |
|
37 // Create the basic list box |
|
38 iListBox = new(ELeave) CEikColumnListBox; |
|
39 //This view is parent. Also constructs the associated list box model and item drawer for the list box. |
|
40 iListBox->ConstructL( this, CEikListBox::EMultipleSelection); |
|
41 |
|
42 iListBox->SetContainerWindowL( *this); |
|
43 iListBox->CreateScrollBarFrameL(); |
|
44 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, |
|
45 CEikScrollBarFrame::EAuto); |
|
46 |
|
47 iListBox->SetPosition(TPoint(iBorder, aTablePosition + iBorder)); |
|
48 |
|
49 iListBox->SetSize(Rect().Size()-TSize(0, aTablePosition)-TSize(iBorder*2, iBorder*2)); |
|
50 |
|
51 iListBox->ActivateL(); |
|
52 |
|
53 iModel = iListBox->Model(); |
|
54 |
|
55 iTextArray = iModel->ItemTextArray(); |
|
56 iListBoxItems = static_cast<CDesCArray*>(iTextArray); |
|
57 iListBoxData = static_cast<CColumnListBoxItemDrawer*>(iListBox->View()->ItemDrawer())->ColumnData(); |
|
58 |
|
59 iRowItem.CreateL(500); |
|
60 |
|
61 #ifdef HW |
|
62 LOG_MSG("CResourceList::ConstructL: iCoreDumpSession->Connect() \n"); |
|
63 TInt err = iCoreDumpSession.Connect(); |
|
64 if (err != KErrNone) |
|
65 { |
|
66 LOG_MSG2("CResourceList::ConstructL: iCoreDumpSession->Connect() failed!, err:%d\n", err); |
|
67 User::Leave(err); |
|
68 } |
|
69 #endif |
|
70 } |
|
71 |
|
72 CResourceList::~CResourceList() |
|
73 { |
|
74 delete iListBox; |
|
75 iModel = NULL; |
|
76 iTextArray = NULL; |
|
77 iListBoxItems = NULL; |
|
78 iListBoxData = NULL; |
|
79 iCoreDumpSession.Disconnect(); |
|
80 iRowItem.Close(); |
|
81 |
|
82 iCrashList.ResetAndDestroy(); |
|
83 iCrashList.Close(); |
|
84 |
|
85 } |
|
86 |
|
87 CCoeControl* CResourceList::GetListBox() const |
|
88 { |
|
89 return iListBox; |
|
90 } |
|
91 |
|
92 void CResourceList::EmptyList() |
|
93 { |
|
94 iListBoxItems->Reset(); |
|
95 iListBox->Reset(); |
|
96 } |
|
97 |
|
98 void CResourceList::ConfigurePluginL() |
|
99 { |
|
100 LOG_MSG( "->[UI]CResourceList::ConfigurePlugin" ); |
|
101 const CListBoxView::CSelectionIndexArray * indexes = iListBox->SelectionIndexes(); |
|
102 |
|
103 if (indexes->Count()> 0) |
|
104 { |
|
105 TPtrC e = (*iListBoxItems)[indexes->At(0)]; |
|
106 |
|
107 TLex input(e); |
|
108 |
|
109 //Get the instance ID |
|
110 input.Mark(); |
|
111 input.SkipCharacters(); |
|
112 TInt instanceId; |
|
113 // extract ID |
|
114 if (input.TokenLength()) // if valid potential token |
|
115 { |
|
116 TLex inst(input.MarkedToken()); |
|
117 inst.Val(instanceId); |
|
118 } |
|
119 LOG_MSG2("\tPlugin Instance ID = %d", instanceId); |
|
120 |
|
121 do |
|
122 { |
|
123 input.Get(); |
|
124 } |
|
125 while (input.Peek()!= '\t'); |
|
126 |
|
127 |
|
128 input.SkipSpace(); |
|
129 input.Mark(); |
|
130 input.SkipCharacters(); |
|
131 TUint u; |
|
132 // extract UID |
|
133 if (input.TokenLength()) // if valid potential token |
|
134 { |
|
135 TPtrC p = input.MarkedToken(); |
|
136 TLex value(p.Mid(2)); // leave out 0x |
|
137 value.Val(u, EHex); |
|
138 } |
|
139 TUid uid = TUid::Uid(u); |
|
140 LOG_MSG2( "\tCResourceList::ConfigurePlugin, UID in hex: %x" , u); |
|
141 |
|
142 RPluginList data; |
|
143 CleanupClosePushL(data); |
|
144 LOG_MSG( "\tCResourceList::GetPluginList iCoreDumpSession->GetPluginsL(data)" ); |
|
145 TRAPD(err, iCoreDumpSession.GetPluginListL(data)); |
|
146 if (err != KErrNone) |
|
147 { |
|
148 TBuf<23> buf; |
|
149 buf.Format(_L("Error: %d"), err); |
|
150 CEikonEnv::InfoWinL(_L("Could not get plugin list from CDS!"), buf); |
|
151 User::Leave(err); |
|
152 } |
|
153 |
|
154 CleanupStack::PopAndDestroy(&data); |
|
155 CConfigurePluginDialog* dialog = new(ELeave) CConfigurePluginDialog(uid, iCoreDumpSession, instanceId); |
|
156 |
|
157 dialog->ExecuteLD(R_CONFIGURE_PLUGIN_DIALOG); |
|
158 } |
|
159 |
|
160 } |
|
161 |
|
162 void CResourceList::BindPluginsL() |
|
163 { |
|
164 //Get selected items |
|
165 LOG_MSG("->[UI]CResourceList::BindPluginsL()"); |
|
166 const CListBoxView::CSelectionIndexArray* indexes = iListBox->SelectionIndexes(); |
|
167 TInt numSelected = indexes->Count(); |
|
168 |
|
169 TBuf<50> errBuf; |
|
170 errBuf.Format(_L("Must Select one formatter and one writer to bind")); |
|
171 |
|
172 TInt writerInstance = -1; |
|
173 TInt formatterInstance = -1; |
|
174 |
|
175 for(TInt cnt =0; cnt < numSelected; cnt++) |
|
176 { |
|
177 TPtrC e = (*iListBoxItems)[indexes->At(cnt)]; |
|
178 |
|
179 TLex input(e); |
|
180 |
|
181 //Get the instance ID |
|
182 input.Mark(); |
|
183 input.SkipCharacters(); |
|
184 TInt instanceId; |
|
185 // extract ID |
|
186 if (input.TokenLength()) // if valid potential token |
|
187 { |
|
188 TLex inst(input.MarkedToken()); |
|
189 inst.Val(instanceId); |
|
190 } |
|
191 LOG_MSG2("\tPlugin Instance ID = %d", instanceId); |
|
192 |
|
193 do |
|
194 { |
|
195 input.Get(); |
|
196 } |
|
197 while (input.Peek()!= '\t'); |
|
198 |
|
199 //head on to the last tab |
|
200 input.SkipSpace(); |
|
201 input.Mark(); |
|
202 input.SkipCharacters(); |
|
203 |
|
204 input.SkipSpace(); |
|
205 input.Mark(); |
|
206 input.SkipCharacters(); |
|
207 // Extract plugin type |
|
208 if (input.TokenLength()) // if valid potential token |
|
209 { |
|
210 TPtrC p = input.MarkedToken(); |
|
211 if (p.Compare(_L("Formatter"))== 0) |
|
212 { |
|
213 formatterInstance = instanceId; |
|
214 } |
|
215 else if (p.Compare(_L("Writer"))== 0) |
|
216 { |
|
217 writerInstance = instanceId; |
|
218 } |
|
219 } |
|
220 |
|
221 } |
|
222 |
|
223 LOG_MSG3("\tFormatter Instance ID = %d will be bound to Writer Instance ID = %d", formatterInstance, writerInstance); |
|
224 |
|
225 if(formatterInstance < 0 || writerInstance < 0) |
|
226 { |
|
227 CEikonEnv::InfoWinL(_L("Cannot bind"), errBuf); |
|
228 return; |
|
229 } |
|
230 |
|
231 //Now we have a fomatter and writer and so can bind |
|
232 TPluginRequest bindReq; |
|
233 bindReq.iIndex = formatterInstance; |
|
234 bindReq.iPair = writerInstance; |
|
235 bindReq.iUid = TUid::Uid(0); |
|
236 |
|
237 #ifdef HW |
|
238 TRAPD(ret, iCoreDumpSession.PluginRequestL(bindReq)); |
|
239 if(ret != KErrNone) |
|
240 { |
|
241 errBuf.Format(_L("Error: %d"), ret); |
|
242 CEikonEnv::InfoWinL(_L("Cannot bind"), errBuf); |
|
243 return; |
|
244 } |
|
245 #endif |
|
246 } |
|
247 |
|
248 void CResourceList::DeleteEntireCrashPartitionL() |
|
249 { |
|
250 LOG_MSG("->[UI]CResourceList::DeleteCrashPartitionL()"); |
|
251 |
|
252 iCoreDumpSession.DeleteCrashPartitionL(); |
|
253 } |
|
254 |
|
255 /** |
|
256 * Deletes the crash via the core dump server interface, using the UI's currently selected crash(es) |
|
257 * @return void |
|
258 */ |
|
259 void CResourceList::DeleteCrashLogL() |
|
260 { |
|
261 LOG_MSG("->[UI]CResourceList::DeleteCrashLogL()"); |
|
262 |
|
263 RArray<TInt>* crashIds = GetMarkedCrashIDsFromUIL(); |
|
264 |
|
265 for(TInt cnt = crashIds->Count() - 1; cnt >= 0; cnt--) |
|
266 { |
|
267 iCoreDumpSession.DeleteCrashLogL((*crashIds)[cnt]); |
|
268 } |
|
269 |
|
270 crashIds->Close(); |
|
271 delete crashIds; |
|
272 } |
|
273 |
|
274 /** |
|
275 * Processes the crash via the core dump server interface, using the UI's currently selected crash(es) |
|
276 * @return void |
|
277 */ |
|
278 void CResourceList::ProcessCrashL() |
|
279 { |
|
280 LOG_MSG("->[UI]CResourceList::ProcessCrashL()"); |
|
281 |
|
282 RArray<TInt>* crashIds = GetMarkedCrashIDsFromUIL(); |
|
283 |
|
284 if(!crashIds) |
|
285 { |
|
286 CEikonEnv::Static()->InfoMsg(_L("No crashes Selected (null crashIds")); |
|
287 } |
|
288 else if (crashIds->Count() == 0) |
|
289 { |
|
290 CEikonEnv::Static()->InfoMsg(_L("No crashes Selected")); |
|
291 } |
|
292 else |
|
293 { |
|
294 for(TInt cnt = crashIds->Count() -1; cnt >= 0; cnt--) |
|
295 { |
|
296 /* TCrashInfo* inf = GetCrashInfoL((*crashIds)[cnt]); |
|
297 iCoreDumpSession.ProcessCrashLogL(*inf);*/ |
|
298 iCoreDumpSession.ProcessCrashLogL((*crashIds)[cnt]); |
|
299 } |
|
300 } |
|
301 crashIds->Close(); |
|
302 delete crashIds; |
|
303 } |
|
304 |
|
305 /** |
|
306 * This helper method looks at the UI Panel and returns an RArray of crashID's for those marked . |
|
307 * Note: Ownership of this array is passed on to the caller |
|
308 * @return RArray of the crashID's marked |
|
309 */ |
|
310 RArray<TInt>* CResourceList::GetMarkedCrashIDsFromUIL() |
|
311 { |
|
312 LOG_MSG("->[UI]CResourceList::GetMarkedCrashIDsFromUIL()"); |
|
313 |
|
314 RArray<TInt>* crashIds = new RArray<TInt>(); |
|
315 |
|
316 const CListBoxView::CSelectionIndexArray* indexes = iListBox->SelectionIndexes(); |
|
317 |
|
318 for(TInt cnt = 0; cnt < indexes->Count(); cnt++) |
|
319 { |
|
320 TPtrC item = (*iListBoxItems)[indexes->At(cnt)]; |
|
321 TLex input(item); |
|
322 |
|
323 //we want to get the crash ID from the UI display - its the first character |
|
324 input.SkipSpace(); |
|
325 input.Mark(); |
|
326 input.SkipCharacters(); |
|
327 |
|
328 TUint crashId; |
|
329 if (input.TokenLength()) // if valid potential token |
|
330 { |
|
331 TLex value(input.MarkedToken()); |
|
332 value.Val(crashId, EDecimal); |
|
333 |
|
334 crashIds->AppendL(crashId); |
|
335 } |
|
336 } |
|
337 |
|
338 return crashIds; |
|
339 } |
|
340 |
|
341 /** |
|
342 * This returns a pointer to the TCrashInfo object in our cached array. Leaves if not found. |
|
343 * @param aCrashId |
|
344 * @return Pointer to crash info object |
|
345 * @leave one of the OS wide Codes |
|
346 */ |
|
347 TCrashInfo* CResourceList::GetCrashInfoL(const TInt aCrashId) |
|
348 { |
|
349 LOG_MSG2("->[UI]CResourceList::GetCrashInfoL(crashID = [%d])", aCrashId); |
|
350 |
|
351 for(TInt cnt = iCrashList.Count() -1; cnt >= 0; cnt--) |
|
352 { |
|
353 if(iCrashList[cnt]->iCrashId == aCrashId) |
|
354 { |
|
355 return iCrashList[cnt]; |
|
356 } |
|
357 } |
|
358 |
|
359 //if we get here, we havent found it |
|
360 User::Leave(KErrNotFound); |
|
361 |
|
362 return NULL; //unreachable, but avoid compiler warnings |
|
363 } |
|
364 |
|
365 void CResourceList::UnloadPluginL() |
|
366 { |
|
367 LOG_MSG("->[UI]CResourceList::UnloadPlugin()"); |
|
368 TPluginRequest unloadReq; |
|
369 |
|
370 const CListBoxView::CSelectionIndexArray* indexes = iListBox->SelectionIndexes(); |
|
371 |
|
372 for(TInt cnt = 0; cnt < indexes->Count(); cnt++) |
|
373 { |
|
374 TPtrC item = (*iListBoxItems)[indexes->At(cnt)]; |
|
375 TLex input(item); |
|
376 |
|
377 TInt tabCnt =0; |
|
378 while(tabCnt < 2) |
|
379 { |
|
380 do |
|
381 { |
|
382 input.Get(); |
|
383 } |
|
384 while (input.Peek()!= '\t'); |
|
385 tabCnt++; |
|
386 } |
|
387 input.SkipSpace(); |
|
388 input.Mark(); |
|
389 input.SkipCharacters(); |
|
390 TUint u; |
|
391 // extract UID |
|
392 if (input.TokenLength()) // if valid potential token |
|
393 { |
|
394 TPtrC p = input.MarkedToken(); |
|
395 TLex value(p.Mid(2)); // skip 0x |
|
396 value.Val(u, EHex); |
|
397 } |
|
398 TUid uid = TUid::Uid(u); |
|
399 unloadReq.iUid = uid; |
|
400 LOG_MSG2("\tUID to unload = %x", uid); |
|
401 |
|
402 //Now get the type... |
|
403 input.SkipSpace(); |
|
404 input.Mark(); |
|
405 input.SkipCharacters(); |
|
406 // Extract plugin type |
|
407 if (input.TokenLength()) // if valid potential token |
|
408 { |
|
409 TPtrC p = input.MarkedToken(); |
|
410 if (p.Compare(_L("Formatter"))== 0) |
|
411 { |
|
412 unloadReq.iPluginType = TPluginRequest::EFormatter; |
|
413 } |
|
414 else if (p.Compare(_L("Writer"))== 0) |
|
415 { |
|
416 unloadReq.iPluginType = TPluginRequest::EWriter; |
|
417 } |
|
418 } |
|
419 } |
|
420 |
|
421 unloadReq.iLoad = EFalse; |
|
422 |
|
423 #ifdef HW |
|
424 TRAPD(err, iCoreDumpSession.PluginRequestL(unloadReq)); |
|
425 if (err != KErrNone) |
|
426 { |
|
427 TBuf<23> buf; |
|
428 buf.Format(_L("Error: %d"), err); |
|
429 CEikonEnv::InfoWinL(_L("Could not load plugin"), buf); |
|
430 LOG_MSG2("\tCResourceList::LoadPlugin could not load plugin: %d", err); |
|
431 } |
|
432 #endif |
|
433 } |
|
434 |
|
435 void CResourceList::LoadPluginL() |
|
436 { |
|
437 LOG_MSG("->[UI]CResourceList::LoadPluginL()"); |
|
438 const CListBoxView::CSelectionIndexArray* indexes = iListBox->SelectionIndexes(); |
|
439 TInt numSelected = indexes->Count(); |
|
440 |
|
441 for(TInt cnt =0; cnt < numSelected; cnt++) |
|
442 { |
|
443 TPtrC e = (*iListBoxItems)[indexes->At(cnt)]; |
|
444 TPluginRequest loadReq; |
|
445 |
|
446 TLex input(e); |
|
447 do // skip all text until first \t |
|
448 { |
|
449 input.Get(); |
|
450 } |
|
451 while (input.Peek()!= '\t'); |
|
452 input.SkipSpace(); |
|
453 input.Mark(); |
|
454 input.SkipCharacters(); |
|
455 TUint u; |
|
456 // extract UID |
|
457 if (input.TokenLength()) // if valid potential token |
|
458 { |
|
459 TPtrC p = input.MarkedToken(); |
|
460 TLex value(p.Mid(2)); // skip 0x |
|
461 value.Val(u, EHex); |
|
462 } |
|
463 TUid uid = TUid::Uid(u); |
|
464 loadReq.iUid = uid; |
|
465 input.SkipSpace(); |
|
466 input.Mark(); |
|
467 input.SkipCharacters(); |
|
468 |
|
469 |
|
470 // Extract plugin type |
|
471 if (input.TokenLength()) // if valid potential token |
|
472 { |
|
473 TPtrC p = input.MarkedToken(); |
|
474 if (p.Compare(_L("Formatter"))== 0) |
|
475 { |
|
476 loadReq.iPluginType = TPluginRequest::EFormatter; |
|
477 } |
|
478 else if (p.Compare(_L("Writer"))== 0) |
|
479 { |
|
480 loadReq.iPluginType = TPluginRequest::EWriter; |
|
481 } |
|
482 } |
|
483 |
|
484 loadReq.iLoad = ETrue; |
|
485 |
|
486 #ifdef HW |
|
487 TRAPD(err, iCoreDumpSession.PluginRequestL(loadReq)); |
|
488 if (err != KErrNone) |
|
489 { |
|
490 TBuf<23> buf; |
|
491 buf.Format(_L("Error: %d"), err); |
|
492 CEikonEnv::InfoWinL(_L("Could not load plugin"), buf); |
|
493 LOG_MSG2("\tCResourceList::LoadPlugin could not load plugin: %d", err); |
|
494 } |
|
495 #endif |
|
496 } |
|
497 } |
|
498 |
|
499 void CResourceList::BuildSelectedListL(TSglQue<TObservationRequest> &aSelectedList) |
|
500 { |
|
501 const CListBoxView::CSelectionIndexArray |
|
502 * indexes = iListBox->SelectionIndexes(); |
|
503 |
|
504 LOG_MSG2("CResoutceList::BuildSelectedListL - no of indexes:%d\n", indexes->Count()); |
|
505 |
|
506 for (TInt i = 0; i < indexes->Count(); i++) |
|
507 { |
|
508 // extract the data |
|
509 TObservationRequest* cdsData = new (ELeave)TObservationRequest; |
|
510 TPtrC line = (*iListBoxItems)[indexes->At(i)]; |
|
511 switch (iObjectsViewed) |
|
512 { |
|
513 case EObjectProcess: |
|
514 { |
|
515 TPtrC namePlus = line.Mid(1+line.Locate('\t')); //skip index |
|
516 TPtrC onlyName = namePlus.Mid(0, namePlus.Locate('\t')); //cut off the rest |
|
517 |
|
518 //LOG_DES(onlyName); |
|
519 cdsData->iTargetName = onlyName; |
|
520 cdsData->iTargetOwnerName = onlyName; |
|
521 } |
|
522 break; |
|
523 |
|
524 case EObjectThread: |
|
525 { |
|
526 TPtrC namePlus = line.Mid(1+line.Locate('\t')); //skip index |
|
527 TPtrC onlyName = namePlus.Mid(0, namePlus.Locate('\t')); //cut off the rest |
|
528 cdsData->iTargetName = onlyName; |
|
529 |
|
530 TPtrC priorityPlus = namePlus.Mid(1+namePlus.Locate('\t')); //skip name |
|
531 TPtrC ownerPlus = priorityPlus.Mid(1+priorityPlus.Locate('\t')); //skip priority |
|
532 |
|
533 //LOG_DES(ownerPlus); |
|
534 TLex value(ownerPlus); |
|
535 TInt ownerId; |
|
536 value.Val(ownerId); |
|
537 |
|
538 LOG_MSG2("owner id:%d\n", ownerId); |
|
539 RProcess rp; |
|
540 TInt err = rp.Open(ownerId); |
|
541 if(err != KErrNone) |
|
542 { |
|
543 LOG_MSG2("unable to open proces handle! err:%d", err); |
|
544 delete cdsData; |
|
545 User::Leave(err); |
|
546 } |
|
547 cdsData->iTargetOwnerName.Copy(rp.FileName()); |
|
548 rp.Close(); |
|
549 } |
|
550 break; |
|
551 |
|
552 case EObjectExecutable: |
|
553 { |
|
554 TPtrC name = line.Mid(0, line.Locate('\t')); |
|
555 |
|
556 cdsData->iTargetName = name; |
|
557 cdsData->iTargetOwnerName = name; |
|
558 } |
|
559 |
|
560 default: |
|
561 break; |
|
562 } |
|
563 aSelectedList.AddLast(*cdsData); |
|
564 } |
|
565 } |
|
566 |
|
567 void CResourceList::SetObservedL() |
|
568 { |
|
569 |
|
570 switch (iObjectsViewed) |
|
571 { |
|
572 case EObjectProcess: |
|
573 { |
|
574 SetObservedProcessesL(); |
|
575 break; |
|
576 } |
|
577 |
|
578 case EObjectThread: |
|
579 { |
|
580 SetObservedThreadsL(); |
|
581 break; |
|
582 } |
|
583 case EObjectExecutable: |
|
584 { |
|
585 SetObservedExecutablesL(); |
|
586 break; |
|
587 } |
|
588 |
|
589 default: |
|
590 break; |
|
591 } |
|
592 } |
|
593 |
|
594 /** |
|
595 Cleanup item implementation for selection list in SetObserved() methods. |
|
596 */ |
|
597 void CResourceList::CleanupSelection(TAny *aList) |
|
598 { |
|
599 TSglQue<TObservationRequest> *selectedList = static_cast<TSglQue<TObservationRequest>*>(aList); |
|
600 TSglQueIter<TObservationRequest> selIter(*selectedList); |
|
601 selIter.SetToFirst(); |
|
602 TObservationRequest *selItem; |
|
603 while( (selItem = selIter++) != NULL) |
|
604 { |
|
605 selectedList->Remove(*selItem); |
|
606 delete selItem; |
|
607 } |
|
608 } |
|
609 |
|
610 /** |
|
611 Cleanup item implementation for process list in SetObservedProcesses() method. |
|
612 */ |
|
613 void CResourceList::CleanupProcessList(TAny *aArray) |
|
614 { |
|
615 RProcessPointerList *processList = static_cast<RProcessPointerList*> (aArray); |
|
616 processList->ResetAndDestroy(); |
|
617 processList->Close(); |
|
618 } |
|
619 |
|
620 void CResourceList::SetObservedProcessesL() |
|
621 { |
|
622 LOG_MSG("->CResourceList::SetObservedProcesses()\n"); |
|
623 |
|
624 RProcessPointerList processList; |
|
625 TCleanupItem cleanupProcesses(CResourceList::CleanupProcessList, (TAny*)&processList); |
|
626 CleanupStack::PushL(cleanupProcesses); |
|
627 |
|
628 TRAPD(err, iCoreDumpSession.GetProcessesL(processList)); |
|
629 if(err != KErrNone) |
|
630 { |
|
631 LOG_MSG2("CResourceList::SetObservedProcesses - unable get process list! err:%d\n", err); |
|
632 TBuf<23> error; |
|
633 error.Format(_L("Error: %d"), err); |
|
634 CEikonEnv::InfoWinL(_L("Unable to get process list!"), error); |
|
635 User::Leave(err); |
|
636 } |
|
637 |
|
638 TSglQue<TObservationRequest> selectedList(TObservationRequest::iOffset); |
|
639 TCleanupItem cleanupSelection(CResourceList::CleanupSelection, (TAny*)&selectedList); |
|
640 CleanupStack::PushL(cleanupSelection); |
|
641 BuildSelectedListL(selectedList); |
|
642 |
|
643 TSglQueIter<TObservationRequest> selIter(selectedList); |
|
644 TObservationRequest *selItem; |
|
645 selIter.SetToFirst(); |
|
646 while((selItem = selIter++) != NULL) |
|
647 { |
|
648 //locate and inspect the target |
|
649 TBool observe = ETrue; |
|
650 for(TInt i = 0; i < processList.Count(); i++) |
|
651 { |
|
652 if(processList[i]->Name() == selItem->iTargetName) |
|
653 { |
|
654 //choose the right action - toggle states |
|
655 observe = !processList[i]->Observed(); |
|
656 break; |
|
657 } |
|
658 } |
|
659 |
|
660 LOG_MSG("CResourceList::SetObservedProcesses -> iCoreDumpSession->ObservationRequestL()\n"); |
|
661 TRAP(err, iCoreDumpSession.ObservationRequestL(selItem->iTargetName, selItem->iTargetOwnerName, observe)); |
|
662 if (err != KErrNone) |
|
663 { |
|
664 LOG_MSG3("CResourceList::SetObservedProcesses - unable to perform action:%d! err:%d\n", observe, err); |
|
665 TBuf<23> error; |
|
666 RBuf buf; |
|
667 buf.CreateL(KMaxFullName); |
|
668 error.Format(_L("Error: %d"), err); |
|
669 if(observe) |
|
670 buf.Append(_L("Unable to attach to ")); |
|
671 else |
|
672 buf.Append(_L("Unable to detach from ")); |
|
673 |
|
674 buf.AppendFormat(_L("process:%S"), &selItem->iTargetName); |
|
675 CEikonEnv::InfoWinL(buf, error); |
|
676 buf.Close(); |
|
677 } |
|
678 } |
|
679 CleanupStack::PopAndDestroy(2); //results in calling CleanupProcessList and CleanupSelection |
|
680 } |
|
681 |
|
682 void CResourceList::SetObservedExecutablesL() |
|
683 { |
|
684 LOG_MSG("->CResourceList::SetObservedExecutablesL()\n"); |
|
685 |
|
686 RExecutablePointerList exeList; |
|
687 TCleanupItem cleanupExes(CResourceList::CleanupExecutableList, (TAny*)&exeList); |
|
688 CleanupStack::PushL(cleanupExes); |
|
689 |
|
690 TRAPD(err, iCoreDumpSession.GetExecutablesL(exeList)); |
|
691 if(err != KErrNone) |
|
692 { |
|
693 LOG_MSG2("CResourceList::SetObservedExecutablesL - unable get exe list! err:%d\n", err); |
|
694 TBuf<23> error; |
|
695 error.Format(_L("Error: %d"), err); |
|
696 CEikonEnv::InfoWinL(_L("Unable to get executable list"), error); |
|
697 User::Leave(err); |
|
698 } |
|
699 |
|
700 TSglQue<TObservationRequest> selectedList(TObservationRequest::iOffset); |
|
701 TCleanupItem cleanupSelection(CResourceList::CleanupSelection, (TAny*)&selectedList); |
|
702 CleanupStack::PushL(cleanupSelection); |
|
703 BuildSelectedListL(selectedList); |
|
704 LOG_MSG("selected list built"); |
|
705 |
|
706 TSglQueIter<TObservationRequest> selIter(selectedList); |
|
707 TObservationRequest *selItem; |
|
708 selIter.SetToFirst(); |
|
709 while((selItem = selIter++) != NULL) |
|
710 { |
|
711 //locate and inspect the target |
|
712 TBool observe = ETrue; |
|
713 LOG_MSG("Looking through the exe list to mark as observed"); |
|
714 for(TInt i = 0; i < exeList.Count(); i++) |
|
715 { |
|
716 if(exeList[i]->Name() == selItem->iTargetName) |
|
717 { |
|
718 //choose the right action - toggle states |
|
719 observe = !exeList[i]->Observed(); |
|
720 break; |
|
721 } |
|
722 } |
|
723 |
|
724 LOG_MSG("CResourceList::SetObservedExecutables -> iCoreDumpSession->ObservationRequestL() Observing:"); |
|
725 TRAP(err, iCoreDumpSession.ObservationRequestL(selItem->iTargetName, selItem->iTargetOwnerName, observe)); |
|
726 if (err != KErrNone) |
|
727 { |
|
728 LOG_MSG3("CResourceList::SetObservedExecutables - unable to perform action:%d! err:%d\n", observe, err); |
|
729 TBuf<23> error; |
|
730 RBuf buf; |
|
731 buf.CreateL(KMaxFullName); |
|
732 error.Format(_L("Error: %d"), err); |
|
733 if(observe) |
|
734 buf.Append(_L("Unable to attach to ")); |
|
735 else |
|
736 buf.Append(_L("Unable to detach from ")); |
|
737 |
|
738 buf.AppendFormat(_L("executable:%S"), &selItem->iTargetName); |
|
739 CEikonEnv::InfoWinL(buf, error); |
|
740 buf.Close(); |
|
741 } |
|
742 } |
|
743 CleanupStack::PopAndDestroy(2); //results in calling CleanupProcessList and CleanupSelection |
|
744 |
|
745 } |
|
746 |
|
747 /** |
|
748 Cleanup item implementation for thread list in SetObservedThreads() method. |
|
749 */ |
|
750 void CResourceList::CleanupThreadList(TAny *aArray) |
|
751 { |
|
752 RThreadPointerList *threadList = static_cast<RThreadPointerList*> (aArray); |
|
753 threadList->ResetAndDestroy(); |
|
754 threadList->Close(); |
|
755 } |
|
756 |
|
757 void CResourceList::CleanupExecutableList(TAny *aArray) |
|
758 { |
|
759 RExecutablePointerList *exeList = static_cast<RExecutablePointerList*> (aArray); |
|
760 exeList->ResetAndDestroy(); |
|
761 exeList->Close(); |
|
762 } |
|
763 |
|
764 void CResourceList::CleanupPluginList(TAny* aArray) |
|
765 { |
|
766 RPluginPointerList* list = static_cast<RPluginPointerList*> (aArray); |
|
767 list->ResetAndDestroy(); |
|
768 list->Close(); |
|
769 } |
|
770 |
|
771 void CResourceList::CleanupCrashList(TAny* aArray) |
|
772 { |
|
773 RCrashInfoPointerList* list = static_cast<RCrashInfoPointerList*> (aArray); |
|
774 list->ResetAndDestroy(); |
|
775 list->Close(); |
|
776 } |
|
777 |
|
778 void CResourceList::SetObservedThreadsL() |
|
779 { |
|
780 LOG_MSG("->CResourceList::SetObservedThreads()\n"); |
|
781 |
|
782 RThreadPointerList threadList; |
|
783 TCleanupItem cleanup(CResourceList::CleanupThreadList, (TAny*)&threadList); |
|
784 CleanupStack::PushL(cleanup); |
|
785 |
|
786 |
|
787 TRAPD(err, iCoreDumpSession.GetThreadsL(threadList)); |
|
788 if(err != KErrNone) |
|
789 { |
|
790 LOG_MSG2("CResourceList::SetObservedProcesses - unable get thread list! err:%d\n", err); |
|
791 TBuf<23> error; |
|
792 error.Format(_L("Error: %d"), err); |
|
793 CEikonEnv::InfoWinL(_L("Unable to get thread list!"), error); |
|
794 User::Leave(err); |
|
795 } |
|
796 |
|
797 TSglQue<TObservationRequest> selectedList(TObservationRequest::iOffset); |
|
798 TCleanupItem cleanupSelection(CResourceList::CleanupSelection, (TAny*)&selectedList); |
|
799 CleanupStack::PushL(cleanupSelection); |
|
800 BuildSelectedListL(selectedList); |
|
801 |
|
802 TSglQueIter<TObservationRequest> selIter(selectedList); |
|
803 TObservationRequest *selItem; |
|
804 selIter.SetToFirst(); |
|
805 while((selItem = selIter++) != NULL) |
|
806 { |
|
807 //locate and inspect the target |
|
808 TBool observe = ETrue; |
|
809 for(TInt i = 0; i < threadList.Count(); i++) |
|
810 { |
|
811 if(threadList[i]->Name() == selItem->iTargetName) |
|
812 { |
|
813 //choose the right action - toggle states |
|
814 observe = !threadList[i]->Observed(); |
|
815 break; |
|
816 } |
|
817 } |
|
818 |
|
819 LOG_MSG("CResourceList::SetObservedThreads -> iCoreDumpSession->ObservationRequestL()\n"); |
|
820 TRAP(err, iCoreDumpSession.ObservationRequestL(selItem->iTargetName, selItem->iTargetOwnerName, observe)); |
|
821 if (err != KErrNone) |
|
822 { |
|
823 LOG_MSG3("CResourceList::SetObservedThreads - unable to perform action:%d! err:%d\n", observe, err); |
|
824 TBuf<23> error; |
|
825 RBuf buf; |
|
826 buf.CreateL(KMaxFullName); |
|
827 error.Format(_L("Error: %d"), err); |
|
828 if(observe) |
|
829 buf.Append(_L("Unable to attach to ")); |
|
830 else |
|
831 buf.Append(_L("Unable to detach from ")); |
|
832 |
|
833 buf.AppendFormat(_L("thread:%S"), &selItem->iTargetName); |
|
834 CEikonEnv::InfoWinL(buf, error); |
|
835 buf.Close(); |
|
836 } |
|
837 } |
|
838 CleanupStack::PopAndDestroy(2); //results in calling CleanupThreadList and CleanupSelection |
|
839 } |
|
840 |
|
841 #define CW_Id 25 |
|
842 #define CW_ProcessName 195 |
|
843 #define CW_Medium 90 |
|
844 #define CW_UID 100 |
|
845 #define CW_Bound 100 |
|
846 #define CW_PluginName 350 |
|
847 #define GapWidth 25 |
|
848 #define CW_Short 60 |
|
849 #define CW_ThreadName 380 |
|
850 #define CW_Priority 85 |
|
851 #define CW_ProcessId 95 |
|
852 #define CW_Writeable 90 |
|
853 #define CW_Read 70 |
|
854 #define CW_FileName 500 |
|
855 #define CW_ExeName 195 |
|
856 #define CW_PluginId 25 |
|
857 #define CW_CRASHID 75 |
|
858 #define CW_CRASHTIME 120 |
|
859 #define CW_CRASHPROCESSED 100 |
|
860 |
|
861 void CResourceList::SetUpProcessTableL() |
|
862 { |
|
863 // deal with the columns |
|
864 iListBoxData->SetColumnWidthPixelL( 0, CW_Id); // Id |
|
865 iListBoxData->SetColumnWidthPixelL( 1, CW_ProcessName); // Name |
|
866 iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); |
|
867 iListBoxData->SetColumnWidthPixelL( 2, CW_FileName); //Observed? |
|
868 iListBoxData->SetColumnHorizontalGapL( 2, GapWidth); |
|
869 iListBoxData->SetColumnAlignmentL( 2, CGraphicsContext::ELeft); |
|
870 |
|
871 _LIT(KTitles, "Id\tName\tObserved"); |
|
872 iListBoxItems->AppendL(KTitles); |
|
873 } |
|
874 |
|
875 void CResourceList::SetUpThreadTableL() |
|
876 { |
|
877 iListBoxData->SetColumnWidthPixelL( 0, CW_Id); |
|
878 iListBoxData->SetColumnWidthPixelL( 1, CW_ThreadName); |
|
879 iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); |
|
880 iListBoxData->SetColumnWidthPixelL( 2, CW_Priority); //Priority |
|
881 iListBoxData->SetColumnAlignmentL( 2, CGraphicsContext::ERight); |
|
882 iListBoxData->SetColumnWidthPixelL( 3, CW_ProcessId); //ProcessId |
|
883 iListBoxData->SetColumnAlignmentL( 3, CGraphicsContext::ERight); |
|
884 iListBoxData->SetColumnWidthPixelL( 4, CW_FileName); //Observed? |
|
885 iListBoxData->SetColumnHorizontalGapL( 4, GapWidth); |
|
886 iListBoxData->SetColumnAlignmentL( 4, CGraphicsContext::ECenter); |
|
887 |
|
888 _LIT(KTitles, "Id\tName\tPriority\tProcess\tObserved"); |
|
889 iListBoxItems->AppendL(KTitles); |
|
890 } |
|
891 |
|
892 void CResourceList::SetUpPluginTableL() |
|
893 { |
|
894 iListBoxData->SetColumnWidthPixelL( 0, CW_PluginName); |
|
895 iListBoxData->SetColumnWidthPixelL( 1, CW_Medium); // Uid |
|
896 iListBoxData->SetColumnAlignmentL(1, CGraphicsContext::ERight); |
|
897 iListBoxData->SetColumnWidthPixelL( 2, CW_Medium + GapWidth); // Type |
|
898 iListBoxData->SetColumnAlignmentL(2, CGraphicsContext::ERight); |
|
899 iListBoxData->SetColumnHorizontalGapL( 2, GapWidth); |
|
900 iListBoxData->SetColumnWidthPixelL( 3, CW_Medium); // Loaded? |
|
901 iListBoxData->SetColumnAlignmentL(3, CGraphicsContext::ERight); |
|
902 |
|
903 _LIT(KTitles, "Name\tUid\tType\tInstances"); |
|
904 iListBoxItems->AppendL(KTitles); |
|
905 } |
|
906 |
|
907 void CResourceList::SetUpExecutableTableL() |
|
908 { |
|
909 iListBoxData->SetColumnWidthPixelL(0, CW_ExeName); //Name of exe |
|
910 iListBoxData->SetColumnAlignmentL(0, CGraphicsContext::ELeft); |
|
911 iListBoxData->SetColumnWidthPixelL(1, CW_FileName); //Observed? |
|
912 iListBoxData->SetColumnHorizontalGapL( 1, GapWidth); |
|
913 iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); |
|
914 |
|
915 _LIT(KTitles, "Name\tObserved"); |
|
916 iListBoxItems->AppendL(KTitles); |
|
917 } |
|
918 |
|
919 void CResourceList::SetUpPluginInstanceTableL() |
|
920 { |
|
921 iListBoxData->SetColumnWidthPixelL( 0, CW_PluginId); |
|
922 iListBoxData->SetColumnWidthPixelL( 1, CW_PluginName); |
|
923 iListBoxData->SetColumnAlignmentL( 1, CGraphicsContext::ELeft); |
|
924 iListBoxData->SetColumnWidthPixelL( 2, CW_UID); // Uid |
|
925 iListBoxData->SetColumnAlignmentL(2, CGraphicsContext::ERight); |
|
926 iListBoxData->SetColumnWidthPixelL( 3, CW_Medium + GapWidth); // Type |
|
927 iListBoxData->SetColumnAlignmentL(3, CGraphicsContext::ERight); |
|
928 iListBoxData->SetColumnHorizontalGapL( 3, GapWidth); |
|
929 iListBoxData->SetColumnWidthPixelL(4, CW_Bound); |
|
930 iListBoxData->SetColumnAlignmentL(4, CGraphicsContext::ERight); |
|
931 |
|
932 _LIT(KTitles, "ID\tName\tUid\tType\tBound To"); |
|
933 iListBoxItems->AppendL(KTitles); |
|
934 } |
|
935 |
|
936 void CResourceList::SetUpCrashListTableL() |
|
937 { |
|
938 iListBoxData->SetColumnWidthPixelL( 0, CW_CRASHID); |
|
939 iListBoxData->SetColumnAlignmentL(0, CGraphicsContext::ELeft); |
|
940 |
|
941 iListBoxData->SetColumnWidthPixelL(1, CW_CRASHTIME); |
|
942 iListBoxData->SetColumnAlignmentL(1, CGraphicsContext::ELeft); |
|
943 |
|
944 iListBoxData->SetColumnWidthPixelL(2, CW_CRASHPROCESSED); |
|
945 iListBoxData->SetColumnAlignmentL(2, CGraphicsContext::ERight); |
|
946 |
|
947 _LIT(KTitles, "Crash ID\tTime Of Crash\tProcessed"); |
|
948 iListBoxItems->AppendL(KTitles); |
|
949 } |
|
950 |
|
951 void CResourceList::SetUpListL() |
|
952 { |
|
953 iListBoxData->SetColumnWidthPixelL( 0, 300); |
|
954 } |
|
955 |
|
956 void CResourceList::UpdateListDataL() |
|
957 { |
|
958 LOG_MSG("->[UI]CResourceList::UpdateListDataL()"); |
|
959 switch (iObjectsViewed) |
|
960 { |
|
961 case EObjectProcess: |
|
962 { |
|
963 EmptyList(); |
|
964 SetUpProcessTableL(); |
|
965 break; |
|
966 } |
|
967 case EObjectThread: |
|
968 { |
|
969 EmptyList(); |
|
970 SetUpThreadTableL(); |
|
971 break; |
|
972 } |
|
973 case EObjectPlugin: |
|
974 { |
|
975 EmptyList(); |
|
976 SetUpPluginTableL(); |
|
977 break; |
|
978 } |
|
979 case EObjectPluginInstance: |
|
980 { |
|
981 EmptyList(); |
|
982 SetUpPluginInstanceTableL(); |
|
983 break; |
|
984 } |
|
985 case EObjectExecutable: |
|
986 { |
|
987 EmptyList(); |
|
988 SetUpExecutableTableL(); |
|
989 break; |
|
990 } |
|
991 case EObjectCrashList: |
|
992 { |
|
993 EmptyList(); |
|
994 SetUpCrashListTableL(); |
|
995 break; |
|
996 } |
|
997 default: |
|
998 { |
|
999 break; |
|
1000 } |
|
1001 } |
|
1002 GetResourceListL(); |
|
1003 } |
|
1004 |
|
1005 void CResourceList::GetResourceListL() |
|
1006 { |
|
1007 switch (iObjectsViewed) |
|
1008 { |
|
1009 case EObjectProcess: |
|
1010 { |
|
1011 GetProcessListL(); |
|
1012 break; |
|
1013 } |
|
1014 case EObjectThread: |
|
1015 { |
|
1016 GetThreadListL(); |
|
1017 break; |
|
1018 } |
|
1019 case EObjectPlugin: |
|
1020 { |
|
1021 GetPluginListL(); |
|
1022 break; |
|
1023 } |
|
1024 case EObjectPluginInstance: |
|
1025 { |
|
1026 GetPluginInstancesListL(); |
|
1027 break; |
|
1028 } |
|
1029 case EObjectExecutable: |
|
1030 { |
|
1031 GetExecutableListL(); |
|
1032 break; |
|
1033 } |
|
1034 case EObjectCrashList: |
|
1035 { |
|
1036 GetCrashListL(); |
|
1037 break; |
|
1038 } |
|
1039 default: |
|
1040 { |
|
1041 break; |
|
1042 } |
|
1043 } |
|
1044 |
|
1045 iListBox->HandleItemAdditionL(); |
|
1046 iListBox->DrawDeferred(); |
|
1047 |
|
1048 } |
|
1049 |
|
1050 /** |
|
1051 * Gets the crash list from the CDS server |
|
1052 * @leave one of the OS wide error codes |
|
1053 */ |
|
1054 void CResourceList::GetCrashListL() |
|
1055 { |
|
1056 LOG_MSG("->[UI]CResourceList::GetCrashListL()"); |
|
1057 |
|
1058 //Get the list and for each crash, add it to the UI |
|
1059 iCoreDumpSession.ListCrashesInFlashL(iCrashList); |
|
1060 TInt crashCnt = iCrashList.Count() -1; |
|
1061 |
|
1062 for(; crashCnt >=0; crashCnt--) |
|
1063 { |
|
1064 AddRowL(*(iCrashList[crashCnt])); |
|
1065 } |
|
1066 |
|
1067 UpdateResourceCount(iCrashList.Count()); |
|
1068 } |
|
1069 |
|
1070 void CResourceList::GetPluginInstancesListL() |
|
1071 { |
|
1072 //Get loaded plugin instances |
|
1073 LOG_MSG("->[UI]CResourceList::GetPluginInstancesListL()"); |
|
1074 RPluginPointerList pluginPtrList; |
|
1075 TCleanupItem cleanup(CResourceList::CleanupPluginList, (TAny*)&pluginPtrList); |
|
1076 CleanupStack::PushL(cleanup); |
|
1077 TInt totalPluginCount = 0; |
|
1078 |
|
1079 LOG_MSG("\tCResourceList::GetPluginInstancesListL() iCoreDumpSession.GetFormattersL(pluginPtrList);"); |
|
1080 iCoreDumpSession.GetFormattersL(pluginPtrList); |
|
1081 LOG_MSG2("\tCResourceList::GetPluginInstancesListL() Found %d formatters", pluginPtrList.Count()); |
|
1082 |
|
1083 for(TInt cnt = 0; cnt < pluginPtrList.Count(); cnt ++) |
|
1084 { |
|
1085 iPluginInstanceData.iIdString.Format(_L("%d"), cnt); |
|
1086 iPluginInstanceData.iName = pluginPtrList[cnt]->Name(); |
|
1087 iPluginInstanceData.iUid.Format(_L("0x%X"), pluginPtrList[cnt]->Uid()); |
|
1088 iPluginInstanceData.iType = _L("Formatter"); |
|
1089 if(pluginPtrList[cnt]->Pair() == KMaxTUint32) |
|
1090 { |
|
1091 iPluginInstanceData.iBoundTo.Format(_L("-")); |
|
1092 } |
|
1093 else |
|
1094 { |
|
1095 iPluginInstanceData.iBoundTo.Format(_L("%u"), pluginPtrList[cnt]->Pair()); |
|
1096 } |
|
1097 |
|
1098 AddRowL(iPluginInstanceData); |
|
1099 |
|
1100 totalPluginCount++; |
|
1101 } |
|
1102 |
|
1103 CleanupStack::PopAndDestroy(&pluginPtrList); |
|
1104 |
|
1105 //Now we get the writer list |
|
1106 LOG_MSG("\tCResourceList::GetPluginInstancesListL() iCoreDumpSession.GetWritersL(pluginPtrList);"); |
|
1107 iCoreDumpSession.GetWritersL(pluginPtrList); |
|
1108 LOG_MSG2("\tCResourceList::GetPluginInstancesListL() Found %d writers", pluginPtrList.Count()); |
|
1109 CleanupStack::PushL(cleanup); |
|
1110 |
|
1111 for(TInt cnt = 0; cnt < pluginPtrList.Count(); cnt++) |
|
1112 { |
|
1113 iPluginInstanceData.iIdString.Format(_L("%d"), cnt); |
|
1114 iPluginInstanceData.iName = pluginPtrList[cnt]->Name(); |
|
1115 iPluginInstanceData.iUid.Format(_L("0x%X"), pluginPtrList[cnt]->Uid()); |
|
1116 iPluginInstanceData.iType = _L("Writer"); |
|
1117 iPluginInstanceData.iBoundTo.Format(_L("")); |
|
1118 AddRowL(iPluginInstanceData); |
|
1119 |
|
1120 totalPluginCount++; |
|
1121 } |
|
1122 |
|
1123 |
|
1124 UpdateResourceCount(totalPluginCount); |
|
1125 CleanupStack::PopAndDestroy(&pluginPtrList); |
|
1126 } |
|
1127 |
|
1128 void CResourceList::GetExecutableListL() |
|
1129 { |
|
1130 //Get executables |
|
1131 RExecutablePointerList exes; |
|
1132 LOG_MSG("CResourceList::GetExecutableListL() iCoreDumpSession.GetExecutablesL(exes)"); |
|
1133 TRAPD(err, iCoreDumpSession.GetExecutablesL(exes)); |
|
1134 if( err != KErrNone ) |
|
1135 { |
|
1136 LOG_MSG2("CResourceList::GetExecutableListL() - unable to get exe list! err:%d", err); |
|
1137 TBuf<23> error; |
|
1138 error.Format(_L("Error: %d"), err); |
|
1139 CEikonEnv::InfoWinL(_L("Unable to get executable list!"), error); |
|
1140 User::Leave(err); |
|
1141 } |
|
1142 |
|
1143 for( TInt i = 0; i < exes.Count(); i++) |
|
1144 { |
|
1145 iExeData.iExeName.Copy(exes[i]->Name()); |
|
1146 iExeData.iObserved.Copy(KSpaces); |
|
1147 |
|
1148 if(exes[i]->Observed()) |
|
1149 { |
|
1150 iExeData.iObserved.Copy(KYes); |
|
1151 } |
|
1152 |
|
1153 AddRowL(iExeData); |
|
1154 } |
|
1155 UpdateResourceCount(exes.Count()); |
|
1156 exes.ResetAndDestroy(); |
|
1157 } |
|
1158 |
|
1159 void CResourceList::GetProcessListL() |
|
1160 { |
|
1161 // get data from CDS |
|
1162 RProcessPointerList processes; |
|
1163 LOG_MSG(" CResourceList::GetProcessList iCoreDumpSession->GetProcessesL(processes)" ); |
|
1164 TRAPD(err, iCoreDumpSession.GetProcessesL(processes)); |
|
1165 if (err != KErrNone) |
|
1166 { |
|
1167 LOG_MSG2("CResourceList::GetProcessListL() - unable to get process list! err:%d", err); |
|
1168 TBuf<23> error; |
|
1169 error.Format(_L("Error: %d"), err); |
|
1170 CEikonEnv::InfoWinL(_L("Unable to get process list!"), error); |
|
1171 User::Leave(err); |
|
1172 } |
|
1173 |
|
1174 for (TInt i = 0; i < processes.Count(); i++) |
|
1175 { |
|
1176 iProcessData.iIdString.Format(KFormatDec, processes[i]->Id()); |
|
1177 iProcessData.iProcessName.Copy(processes[i]->Name()); |
|
1178 |
|
1179 iProcessData.iObserved.Copy(KSpaces); |
|
1180 if(processes[i]->Observed()) |
|
1181 { |
|
1182 iProcessData.iObserved.Copy(KYes); |
|
1183 } |
|
1184 |
|
1185 AddRowL(iProcessData); |
|
1186 } |
|
1187 UpdateResourceCount(processes.Count()); |
|
1188 processes.ResetAndDestroy(); |
|
1189 } |
|
1190 |
|
1191 void CResourceList::GetThreadListL(void) |
|
1192 { |
|
1193 // get data from CDS |
|
1194 RThreadPointerList threads; |
|
1195 LOG_MSG( "CResourceList::GetThreadList iCoreDumpSession->GetThreadsL(&threads);" ); |
|
1196 TRAPD(err, iCoreDumpSession.GetThreadsL(threads)); |
|
1197 if (err != KErrNone) |
|
1198 { |
|
1199 LOG_MSG2("CResourceList::GetThreadListL() - unable to get thread list! err:%d", err); |
|
1200 TBuf<23> error; |
|
1201 error.Format(_L("Error: %d"), err); |
|
1202 CEikonEnv::InfoWinL(_L("Unable to get thread list!"), error); |
|
1203 User::Leave(err); |
|
1204 } |
|
1205 |
|
1206 LOG_MSG2( "CResourceList::GetThreadList threads->Count() = %d", threads.Count()); |
|
1207 for (TInt i = 0; i<threads.Count(); i++) |
|
1208 { |
|
1209 |
|
1210 iThreadData.iIdString.Format(KFormatDec, threads[i]->Id()); |
|
1211 |
|
1212 // Name |
|
1213 iThreadData.iThreadName.Copy(threads[i]->Name()); |
|
1214 |
|
1215 // Priority |
|
1216 iThreadData.iPriorityString.Format(KFormatDec, threads[i]->Priority()); |
|
1217 |
|
1218 // Owner Process |
|
1219 iThreadData.iOwnerIdString.Format(KFormatDec, threads[i]->ProcessId()); |
|
1220 |
|
1221 // Observed |
|
1222 iThreadData.iObserved.Copy(KSpaces); |
|
1223 if(threads[i]->Observed()) |
|
1224 { |
|
1225 iThreadData.iObserved.Copy(KYes); |
|
1226 } |
|
1227 |
|
1228 AddRowL(iThreadData); |
|
1229 } |
|
1230 UpdateResourceCount(threads.Count()); |
|
1231 threads.ResetAndDestroy(); |
|
1232 } |
|
1233 |
|
1234 void CResourceList::CleanupEComArray(TAny* aArray) |
|
1235 { |
|
1236 (static_cast<RImplInfoPtrArray*> (aArray))->ResetAndDestroy(); |
|
1237 (static_cast<RImplInfoPtrArray*> (aArray))->Close(); |
|
1238 } |
|
1239 |
|
1240 void CResourceList::GetPluginListL() |
|
1241 { |
|
1242 // get data from CDS |
|
1243 RPluginList data; |
|
1244 CleanupClosePushL(data); |
|
1245 LOG_MSG( "CResourceList::GetPluginList iCoreDumpSession->GetFormatters(&data)" ); |
|
1246 TRAPD(err, iCoreDumpSession.GetPluginListL(data)); |
|
1247 if (err != KErrNone) |
|
1248 { |
|
1249 TBuf<23> error; |
|
1250 error.Format(_L("Error: %d"), err); |
|
1251 CEikonEnv::InfoWinL(_L("Could not get plugin list!"), error); |
|
1252 User::Leave(err); |
|
1253 } |
|
1254 |
|
1255 LOG_MSG2( "CResourceList::GetPluginList No of plugins is/are: %d", data.Count() ); |
|
1256 |
|
1257 TUIPluginData uiData; |
|
1258 |
|
1259 for (TInt i = 0; i < data.Count(); i++) |
|
1260 { |
|
1261 uiData.iName = data[i].iName; |
|
1262 TUid uid = data[i].iUid; |
|
1263 uiData.iUid.Format(_L("0x%x"), uid); |
|
1264 if (data[i].iType == TPluginRequest::EFormatter) |
|
1265 { |
|
1266 uiData.iType = _L("Formatter"); |
|
1267 uiData.iInstances.Format(_L("%d"), GetNumberFormattersL(uid)); |
|
1268 } |
|
1269 else if (data[i].iType == TPluginRequest::EWriter) |
|
1270 { |
|
1271 uiData.iType = _L("Writer"); |
|
1272 uiData.iInstances.Format(_L("%d"), GetNumberWritersL(uid)); |
|
1273 } |
|
1274 |
|
1275 AddRowL(uiData); |
|
1276 } |
|
1277 UpdateResourceCount(data.Count()); |
|
1278 CleanupStack::PopAndDestroy(&data); |
|
1279 } |
|
1280 |
|
1281 void CResourceList::AddRowL(const TUIProcessData& aProcessData) |
|
1282 { |
|
1283 // The actual item text format depends on the listbox type, see tables with listbox types |
|
1284 iRowItem.Format(_L("%S\t%S\t%S"), &aProcessData.iIdString, |
|
1285 &aProcessData.iProcessName, |
|
1286 &aProcessData.iObserved); |
|
1287 |
|
1288 iListBoxItems->AppendL(iRowItem); |
|
1289 } |
|
1290 |
|
1291 void CResourceList::AddRowL(const TUIPluginData& aPluginData) |
|
1292 { |
|
1293 // The actual item text format depends on the listbox type, see tables with listbox types |
|
1294 iRowItem.Format(_L("%S\t%S\t%S\t%S"), &aPluginData.iName, |
|
1295 &aPluginData.iUid, |
|
1296 &aPluginData.iType, |
|
1297 &aPluginData.iInstances); |
|
1298 |
|
1299 iListBoxItems->AppendL(iRowItem); |
|
1300 } |
|
1301 |
|
1302 void CResourceList::AddRowL(const TUIPluginInstanceData& aPluginInstance) |
|
1303 { |
|
1304 iRowItem.Format(_L("%S\t%S\t%S\t%S\t%S"), |
|
1305 &aPluginInstance.iIdString, |
|
1306 &aPluginInstance.iName, |
|
1307 &aPluginInstance.iUid, |
|
1308 &aPluginInstance.iType, |
|
1309 &aPluginInstance.iBoundTo); |
|
1310 |
|
1311 iListBoxItems->AppendL(iRowItem); |
|
1312 } |
|
1313 |
|
1314 void CResourceList::AddRowL(const TUIThreadData& aThreadData) |
|
1315 { |
|
1316 // The actual item text format depends on the listbox type, see tables with listbox types |
|
1317 iRowItem.Format(_L("%S\t%S\t%S\t%S\t%S"), &aThreadData.iIdString, |
|
1318 &aThreadData.iThreadName, |
|
1319 &aThreadData.iPriorityString, |
|
1320 &aThreadData.iOwnerIdString, |
|
1321 &aThreadData.iObserved); |
|
1322 |
|
1323 iListBoxItems->AppendL(iRowItem); |
|
1324 } |
|
1325 |
|
1326 void CResourceList::AddRowL(const TListData& aListData) |
|
1327 { |
|
1328 // The actual item text format depends on the listbox type, see tables with listbox types |
|
1329 iRowItem.Format(_L("%S"), &aListData.iName); |
|
1330 |
|
1331 iListBoxItems->AppendL(iRowItem); |
|
1332 } |
|
1333 |
|
1334 void CResourceList::AddRowL(const TUIExecutableData& aExeData) |
|
1335 { |
|
1336 // The actual item text format depends on the listbox type, see tables with listbox types |
|
1337 iRowItem.Format(_L("%S\t%S"), &aExeData.iExeName, &aExeData.iObserved); |
|
1338 |
|
1339 iListBoxItems->AppendL(iRowItem); |
|
1340 } |
|
1341 |
|
1342 void CResourceList::AddRowL(const TCrashInfo& aCrashInfo) |
|
1343 { |
|
1344 iRowItem.Format(_L("%d\t%lu"), aCrashInfo.iCrashId, aCrashInfo.iTime); |
|
1345 |
|
1346 iListBoxItems->AppendL(iRowItem); |
|
1347 } |
|
1348 |
|
1349 TInt CResourceList::GetNumberFormattersL(TUid& aUid) |
|
1350 { |
|
1351 TInt numFormatters = 0; |
|
1352 |
|
1353 //Get loaded plugin instances |
|
1354 LOG_MSG("->[UI]CResourceList::GetNumberFormatters(TUid& aUid)"); |
|
1355 RPluginPointerList pluginPtrList; |
|
1356 TCleanupItem cleanup(CResourceList::CleanupPluginList, (TAny*)&pluginPtrList); |
|
1357 CleanupStack::PushL(cleanup); |
|
1358 |
|
1359 LOG_MSG("\tCResourceList::GetNumberFormatters(TUid& aUid) iCoreDumpSession.GetFormattersL(pluginPtrList);"); |
|
1360 LOG_MSG2("\tLooking for Formatters of UID of %x", aUid.iUid); |
|
1361 iCoreDumpSession.GetFormattersL(pluginPtrList); |
|
1362 |
|
1363 for(TInt cnt = 0; cnt < pluginPtrList.Count(); cnt ++) |
|
1364 { |
|
1365 TUid uid = TUid::Uid(pluginPtrList[cnt]->Uid()); |
|
1366 if(uid == aUid) |
|
1367 { |
|
1368 numFormatters++; |
|
1369 } |
|
1370 } |
|
1371 |
|
1372 CleanupStack::PopAndDestroy(&pluginPtrList); |
|
1373 |
|
1374 return numFormatters; |
|
1375 } |
|
1376 |
|
1377 TInt CResourceList::GetNumberWritersL(TUid& aUid) |
|
1378 { |
|
1379 TInt numWriters = 0; |
|
1380 |
|
1381 //Get loaded plugin instances |
|
1382 LOG_MSG("->[UI]CResourceList::GetNumberWritersL(TUid& aUid)"); |
|
1383 RPluginPointerList pluginPtrList; |
|
1384 TCleanupItem cleanup(CResourceList::CleanupPluginList, (TAny*)&pluginPtrList); |
|
1385 CleanupStack::PushL(cleanup); |
|
1386 |
|
1387 LOG_MSG("\tCResourceList::GetNumberWritersL(TUid& aUid) iCoreDumpSession.GetFormattersL(pluginPtrList);"); |
|
1388 LOG_MSG2("\tLooking for Writers of UID of %x", aUid.iUid); |
|
1389 iCoreDumpSession.GetWritersL(pluginPtrList); |
|
1390 |
|
1391 for(TInt cnt = 0; cnt < pluginPtrList.Count(); cnt ++) |
|
1392 { |
|
1393 TUid uid = TUid::Uid(pluginPtrList[cnt]->Uid()); |
|
1394 if(uid == aUid) |
|
1395 { |
|
1396 numWriters++; |
|
1397 } |
|
1398 } |
|
1399 |
|
1400 CleanupStack::PopAndDestroy(&pluginPtrList); |
|
1401 |
|
1402 return numWriters; |
|
1403 } |
|
1404 |