|
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 using System; |
|
18 using System.Text; |
|
19 using System.Collections.Generic; |
|
20 using CrashItemLib.Crash; |
|
21 using CrashItemLib.Crash.Base; |
|
22 using CrashItemLib.Crash.Processes; |
|
23 using CrashItemLib.Crash.Registers; |
|
24 using CrashItemLib.Crash.Stacks; |
|
25 using CrashItemLib.Crash.CodeSegs; |
|
26 using CrashItemLib.Crash.Threads; |
|
27 using CrashItemLib.Crash.Messages; |
|
28 using CrashItemLib.Crash.Container; |
|
29 using SymbianStructuresLib.Arm.Registers; |
|
30 |
|
31 namespace CrashItemLib.Crash.Summarisable |
|
32 { |
|
33 public class CISummarisableEntityList : CIElement |
|
34 { |
|
35 #region Constructors |
|
36 [CIElementAttributeMandatory()] |
|
37 public CISummarisableEntityList( CIContainer aContainer ) |
|
38 : base( aContainer ) |
|
39 { |
|
40 // Restrict children to summaries |
|
41 base.AddSupportedChildType( typeof( CISummarisableEntity ) ); |
|
42 base.AddSupportedChildType( typeof( CrashItemLib.Crash.Messages.CIMessage ) ); |
|
43 } |
|
44 |
|
45 internal CISummarisableEntityList( CIContainer aContainer, IEnumerable<CISummarisableEntity> aArray ) |
|
46 : this( aContainer ) |
|
47 { |
|
48 foreach ( CISummarisableEntity entry in aArray ) |
|
49 { |
|
50 base.AddChild( entry ); |
|
51 } |
|
52 } |
|
53 #endregion |
|
54 |
|
55 #region API |
|
56 #endregion |
|
57 |
|
58 #region Properties |
|
59 public CISummarisableEntity this[ CIThread aEntry ] |
|
60 { |
|
61 get |
|
62 { |
|
63 CISummarisableEntity ret = null; |
|
64 // |
|
65 foreach ( CISummarisableEntity entry in this ) |
|
66 { |
|
67 if ( entry.IsAvailable( CISummarisableEntity.TElement.EElementThread ) ) |
|
68 { |
|
69 if ( entry.Thread.Id == aEntry.Id ) |
|
70 { |
|
71 ret = entry; |
|
72 break; |
|
73 } |
|
74 } |
|
75 } |
|
76 // |
|
77 return ret; |
|
78 } |
|
79 } |
|
80 |
|
81 public CISummarisableEntity this[ CIStack aEntry ] |
|
82 { |
|
83 get |
|
84 { |
|
85 CISummarisableEntity ret = null; |
|
86 // |
|
87 foreach ( CISummarisableEntity entry in this ) |
|
88 { |
|
89 if ( entry.IsAvailable( CISummarisableEntity.TElement.EElementStack ) ) |
|
90 { |
|
91 if ( entry.Stack.Id == aEntry.Id ) |
|
92 { |
|
93 ret = entry; |
|
94 break; |
|
95 } |
|
96 } |
|
97 } |
|
98 // |
|
99 return ret; |
|
100 } |
|
101 } |
|
102 #endregion |
|
103 |
|
104 #region Internal methods |
|
105 #endregion |
|
106 |
|
107 #region From CIElement |
|
108 internal override void DoFinalize( CIElementFinalizationParameters aParams, Queue<CIElement> aCallBackLast, bool aForceFinalize ) |
|
109 { |
|
110 CIContainer container = base.Container; |
|
111 |
|
112 // Find all the stacks and add them as children before we call the base class |
|
113 // method, since the base class will then take care of finalizing the new dynamically created |
|
114 // summarisable objects. |
|
115 CIElementList<CIStack> stacks = container.ChildrenByType<CIStack>( TChildSearchType.EEntireHierarchy ); |
|
116 if ( stacks != null && stacks.Count > 0 ) |
|
117 { |
|
118 foreach( CIStack stack in stacks ) |
|
119 { |
|
120 CISummarisableEntity entity = this[ stack ]; |
|
121 if ( entity == null ) |
|
122 { |
|
123 entity = new CISummarisableEntity( stack ); |
|
124 AddChild( entity ); |
|
125 } |
|
126 } |
|
127 } |
|
128 |
|
129 // Now, make sure there are summarisable wrappers created for any threads which do not have associated |
|
130 // stacks. Call stacks will be unavailable, but there's still plenty of useful information at the thread |
|
131 // process and register levels. |
|
132 CIElementList<CIThread> threads = container.ChildrenByType<CIThread>( TChildSearchType.EEntireHierarchy ); |
|
133 if ( threads != null && threads.Count > 0 ) |
|
134 { |
|
135 foreach ( CIThread thread in threads ) |
|
136 { |
|
137 CISummarisableEntity entity = this[ thread ]; |
|
138 if ( entity == null ) |
|
139 { |
|
140 entity = new CISummarisableEntity( thread ); |
|
141 AddChild( entity ); |
|
142 } |
|
143 } |
|
144 } |
|
145 |
|
146 // Now run finalizers on children et al. |
|
147 base.DoFinalize( aParams, aCallBackLast, aForceFinalize ); |
|
148 } |
|
149 #endregion |
|
150 |
|
151 #region Data members |
|
152 #endregion |
|
153 } |
|
154 } |