|
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 SymbianStructuresLib.Arm.Registers; |
|
21 using CrashItemLib.Crash.Registers; |
|
22 using CrashXmlPlugin.FileFormat.Node; |
|
23 |
|
24 namespace CrashXmlPlugin.FileFormat.Segment.Entries.Registers |
|
25 { |
|
26 internal class CXmlRegisterSet : CXmlNode |
|
27 { |
|
28 #region Constructors |
|
29 public CXmlRegisterSet( CIRegisterList aList ) |
|
30 : base( SegConstants.Registers_RegisterSet ) |
|
31 { |
|
32 iList = aList; |
|
33 } |
|
34 #endregion |
|
35 |
|
36 #region API |
|
37 #endregion |
|
38 |
|
39 #region From CXmlNode |
|
40 protected override void XmlSerializeContent( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
41 { |
|
42 CXmlNode.WriteId( iList, aParameters.Writer ); |
|
43 |
|
44 // Abbreviated type |
|
45 string typeAbbreviated = ArmRegisterBankUtils.BankAsString( iList.Bank ); |
|
46 aParameters.Writer.WriteElementString( SegConstants.CmnType, typeAbbreviated ); |
|
47 |
|
48 // Long type |
|
49 string typeLong = ArmRegisterBankUtils.BankAsStringLong( iList.Bank ); |
|
50 aParameters.Writer.WriteElementString( SegConstants.CmnName, typeLong ); |
|
51 |
|
52 // Link to thread |
|
53 if ( iList.OwningThread != null ) |
|
54 { |
|
55 CXmlNode.WriteLink( iList.OwningThread.Id, SegConstants.Threads, aParameters.Writer ); |
|
56 } |
|
57 } |
|
58 |
|
59 protected override void XmlSerializeChildren( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
60 { |
|
61 if ( iList.IsCurrentProcessorMode ) |
|
62 { |
|
63 aParameters.Writer.WriteStartElement( SegConstants.CmnAttributes ); |
|
64 aParameters.Writer.WriteElementString( SegConstants.Registers_RegisterSet_CurrentBank, string.Empty ); |
|
65 aParameters.Writer.WriteEndElement(); |
|
66 } |
|
67 |
|
68 foreach ( CIRegister register in iList ) |
|
69 { |
|
70 CXmlRegister xmlRegister = new CXmlRegister( register ); |
|
71 xmlRegister.XmlSerialize( aParameters ); |
|
72 } |
|
73 } |
|
74 #endregion |
|
75 |
|
76 #region Properties |
|
77 #endregion |
|
78 |
|
79 #region Data members |
|
80 private readonly CIRegisterList iList; |
|
81 #endregion |
|
82 } |
|
83 } |