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 "MemSpyViewROMInfo.h" |
|
19 |
|
20 // System includes |
|
21 #include <hal.h> |
|
22 #ifdef __EPOC32__ |
|
23 #include <e32rom.h> |
|
24 #endif |
|
25 |
|
26 // Engine includes |
|
27 #include <memspy/engine/memspyengine.h> |
|
28 #include <memspy/engine/memspyengineobjectprocess.h> |
|
29 #include <memspy/engine/memspyengineobjectthread.h> |
|
30 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
31 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
32 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
|
33 #include <memspy/engine/memspyenginehelperprocess.h> |
|
34 |
|
35 // User includes |
|
36 #include "MemSpyUiUtils.h" |
|
37 #include "MemSpyViewMainMenu.h" |
|
38 #include "MemSpyContainerObserver.h" |
|
39 |
|
40 // Remap of E32 DP constants, needed so MemSpy can still build on v9.1 |
|
41 enum TMemSpyDemandPagingKernelConfigFlags |
|
42 { |
|
43 EMemSpyKernelConfigPagingPolicyMask = 3<<5, |
|
44 EMemSpyKernelConfigPagingPolicyNoPaging = 0<<5, |
|
45 EMemSpyKernelConfigPagingPolicyAlwaysPage = 1<<5, |
|
46 EMemSpyKernelConfigPagingPolicyDefaultUnpaged = 2<<5, |
|
47 EMemSpyKernelConfigPagingPolicyDefaultPaged = 3<<5, |
|
48 }; |
|
49 |
|
50 |
|
51 |
|
52 CMemSpyViewROMInfo::CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) |
|
53 : CMemSpyViewBase( aEngine, aObserver ) |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 void CMemSpyViewROMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
59 { |
|
60 _LIT( KTitle, "ROM Info" ); |
|
61 SetTitleL( KTitle ); |
|
62 // |
|
63 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
64 } |
|
65 |
|
66 |
|
67 void CMemSpyViewROMInfo::RefreshL() |
|
68 { |
|
69 SetListBoxModelL(); |
|
70 CMemSpyViewBase::RefreshL(); |
|
71 } |
|
72 |
|
73 |
|
74 TMemSpyViewType CMemSpyViewROMInfo::ViewType() const |
|
75 { |
|
76 return EMemSpyViewTypeROMInfo; |
|
77 } |
|
78 |
|
79 |
|
80 CMemSpyViewBase* CMemSpyViewROMInfo::PrepareParentViewL() |
|
81 { |
|
82 CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); |
|
83 CleanupStack::PushL( parent ); |
|
84 parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); |
|
85 CleanupStack::Pop( parent ); |
|
86 return parent; |
|
87 } |
|
88 |
|
89 |
|
90 CMemSpyViewBase* CMemSpyViewROMInfo::PrepareChildViewL() |
|
91 { |
|
92 CMemSpyViewBase* child = NULL; |
|
93 return child; |
|
94 } |
|
95 |
|
96 |
|
97 void CMemSpyViewROMInfo::SetListBoxModelL() |
|
98 { |
|
99 CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); |
|
100 CleanupStack::PushL( model ); |
|
101 |
|
102 TBuf<KMaxFullName + 1> item; |
|
103 |
|
104 TInt value = 0; |
|
105 TMemSpySizeText valueBuf; |
|
106 TMemSpySizeText valueBuf2; |
|
107 |
|
108 // 1st item = Total RAM |
|
109 _LIT(KItem1Format, "\tROM Size (HAL)\t\t%S"); |
|
110 HAL::Get( HALData::EMemoryROM, value ); |
|
111 valueBuf = MemSpyUiUtils::FormatSizeText( value ); |
|
112 item.Format( KItem1Format, &valueBuf ); |
|
113 model->AppendL( item ); |
|
114 |
|
115 #ifdef __EPOC32__ |
|
116 TBuf<128> buf2; |
|
117 _LIT( KTimeFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" ); |
|
118 const TUint main_start = UserSvr::RomHeaderAddress(); |
|
119 TRomHeader* romHeader = (TRomHeader*) main_start; |
|
120 |
|
121 _LIT(KItem2Format, "\tROM Size (Header)\t\t%S"); |
|
122 valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iRomSize ) ); |
|
123 item.Format( KItem2Format, &valueBuf ); |
|
124 model->AppendL( item ); |
|
125 |
|
126 _LIT(KItem2aFormat, "\tROM Page Size\t\t%S"); |
|
127 HAL::Get( HALData::EMemoryPageSize, value ); |
|
128 valueBuf = MemSpyUiUtils::FormatSizeText( value ); |
|
129 item.Format( KItem2aFormat, &valueBuf ); |
|
130 model->AppendL( item ); |
|
131 |
|
132 _LIT(KItem10Format, "\tVersion\t\tv%2d.%02d.%06d"); |
|
133 item.Format( KItem10Format, romHeader->iVersion.iMajor, romHeader->iVersion.iMinor, romHeader->iVersion.iBuild ); |
|
134 model->AppendL( item ); |
|
135 |
|
136 _LIT(KItem3Format, "\tTimestamp\t\t%S"); |
|
137 TTime time( romHeader->iTime ); |
|
138 time.FormatL( buf2, KTimeFormatSpecLocal ); |
|
139 item.Format( KItem3Format, &buf2 ); |
|
140 model->AppendL( item ); |
|
141 |
|
142 _LIT(KItem4Format, "\tAddress Range\t\t%S - %S"); |
|
143 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomBase ); |
|
144 MemSpyUiUtils::FormatHex( valueBuf2, (romHeader->iRomBase + romHeader->iRomSize )); |
|
145 item.Format( KItem4Format, &valueBuf, &valueBuf2 ); |
|
146 model->AppendL( item ); |
|
147 |
|
148 _LIT(KItem5Format, "\tPrimary File Address\t\t%S"); |
|
149 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iPrimaryFile ); |
|
150 item.Format( KItem5Format, &valueBuf ); |
|
151 model->AppendL( item ); |
|
152 |
|
153 _LIT(KItem6Format, "\tSecondary File Address\t\t%S"); |
|
154 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iSecondaryFile ); |
|
155 item.Format( KItem6Format, &valueBuf ); |
|
156 model->AppendL( item ); |
|
157 |
|
158 _LIT(KItem7Format, "\tChecksum\t\t%S"); |
|
159 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iCheckSum ); |
|
160 item.Format( KItem7Format, &valueBuf ); |
|
161 model->AppendL( item ); |
|
162 |
|
163 _LIT(KItem8Format, "\tKernel Config Flags\t\t%S"); |
|
164 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iKernelConfigFlags ); |
|
165 item.Format( KItem8Format, &valueBuf ); |
|
166 model->AppendL( item ); |
|
167 |
|
168 if ( romHeader->iKernelConfigFlags & EKernelConfigIpcV1Available ) |
|
169 { |
|
170 _LIT(KItem8aFormat, "\tIPC v1 Available\t\tYes"); |
|
171 item.Copy( KItem8aFormat ); |
|
172 model->AppendL( item ); |
|
173 } |
|
174 if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforcement ) |
|
175 { |
|
176 _LIT(KItem8bFormat, "\tPlatSec Enforcement\t\tYes"); |
|
177 item.Copy( KItem8bFormat ); |
|
178 model->AppendL( item ); |
|
179 } |
|
180 if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecDiagnostics ) |
|
181 { |
|
182 _LIT(KItem8cFormat, "\tPlatSec Diagnostics\t\tYes"); |
|
183 item.Copy( KItem8cFormat ); |
|
184 model->AppendL( item ); |
|
185 } |
|
186 if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecProcessIsolation ) |
|
187 { |
|
188 _LIT(KItem8dFormat, "\tPlatSec Process Isolation\t\tYes"); |
|
189 item.Copy( KItem8dFormat ); |
|
190 model->AppendL( item ); |
|
191 } |
|
192 if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforceSysBin ) |
|
193 { |
|
194 _LIT(KItem8eFormat, "\tEnforce \\Sys\\Bin\\\t\tYes"); |
|
195 item.Copy( KItem8eFormat ); |
|
196 model->AppendL( item ); |
|
197 } |
|
198 |
|
199 const TUint32 pagingPolicy = ( romHeader->iKernelConfigFlags & EMemSpyKernelConfigPagingPolicyMask ); |
|
200 #ifdef _DEBUG |
|
201 RDebug::Printf( "pagingPolicy: %u (0x%08x)", pagingPolicy, pagingPolicy ); |
|
202 #endif |
|
203 _LIT(KItem8eFormat, "\tDemand Paging\t\t%S"); |
|
204 // |
|
205 if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyNoPaging ) |
|
206 { |
|
207 _LIT( KDemandPagingPolicyNoPaging, "No Paging" ); |
|
208 item.Format( KItem8eFormat, &KDemandPagingPolicyNoPaging ); |
|
209 } |
|
210 else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyAlwaysPage ) |
|
211 { |
|
212 _LIT( KDemandPagingPolicyAlwaysPage, "Always Paging" ); |
|
213 item.Format( KItem8eFormat, &KDemandPagingPolicyAlwaysPage); |
|
214 } |
|
215 else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultUnpaged ) |
|
216 { |
|
217 _LIT( KDemandPagingPolicyDefaultUnpaged, "Default Unpaged" ); |
|
218 item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultUnpaged); |
|
219 } |
|
220 else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultPaged ) |
|
221 { |
|
222 _LIT( KDemandPagingPolicyDefaultPaged, "Default Paged" ); |
|
223 item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultPaged ); |
|
224 } |
|
225 // |
|
226 model->AppendL( item ); |
|
227 |
|
228 _LIT(KItem9Format, "\tSection Header Address\t\t%S"); |
|
229 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomSectionHeader ); |
|
230 item.Format( KItem9Format, &valueBuf ); |
|
231 model->AppendL( item ); |
|
232 |
|
233 _LIT(KItem11Format, "\tCompressed Size\t\t%S"); |
|
234 valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iCompressedSize ) ); |
|
235 item.Format( KItem11Format, &valueBuf ); |
|
236 model->AppendL( item ); |
|
237 |
|
238 _LIT(KItem12Format, "\tUncompressed Size\t\t%S"); |
|
239 valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iUncompressedSize ) ); |
|
240 item.Format( KItem12Format, &valueBuf ); |
|
241 model->AppendL( item ); |
|
242 |
|
243 _LIT(KItem13Format, "\tDisabled Caps. #1\t\t%S"); |
|
244 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[0] ); |
|
245 item.Format( KItem13Format, &valueBuf ); |
|
246 model->AppendL( item ); |
|
247 |
|
248 _LIT(KItem14Format, "\tDisabled Caps. #2\t\t%S"); |
|
249 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[1] ); |
|
250 item.Format( KItem14Format, &valueBuf ); |
|
251 model->AppendL( item ); |
|
252 |
|
253 for(TInt i=0; i<TRomHeader::KNumTraceMask; i++) |
|
254 { |
|
255 _LIT(KItem15Format, "\tTrace Mask #%d\t\t%S"); |
|
256 MemSpyUiUtils::FormatHex( valueBuf, romHeader->iTraceMask[i] ); |
|
257 item.Format( KItem15Format, i+1, &valueBuf ); |
|
258 model->AppendL( item ); |
|
259 } |
|
260 |
|
261 #endif |
|
262 |
|
263 // Set up list box |
|
264 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
265 listbox->Model()->SetItemTextArray( model ); |
|
266 listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
267 CleanupStack::Pop( model ); |
|
268 } |
|
269 |
|
270 |
|