|
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.Base; |
|
21 using CrashItemLib.Crash.Symbols; |
|
22 using CrashItemLib.Crash.Stacks; |
|
23 using CrashItemLib.Crash.Registers; |
|
24 using CrashItemLib.Crash.CodeSegs; |
|
25 using SymbianStructuresLib.CodeSegments; |
|
26 using CrashXmlPlugin.FileFormat.Node; |
|
27 |
|
28 namespace CrashXmlPlugin.FileFormat.Segment.Entries.CodeSegs |
|
29 { |
|
30 internal class CXmlCodeSeg : CXmlNode |
|
31 { |
|
32 #region Constructors |
|
33 public CXmlCodeSeg( CICodeSeg aCodeSeg ) |
|
34 : base( SegConstants.CodeSegs_CodeSeg ) |
|
35 { |
|
36 iCodeSeg = aCodeSeg; |
|
37 } |
|
38 #endregion |
|
39 |
|
40 #region From CXmlNode |
|
41 protected override void XmlSerializeContent( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
42 { |
|
43 CXmlNode.WriteId( iCodeSeg, aParameters.Writer ); |
|
44 aParameters.Writer.WriteElementString( SegConstants.CmnName, iCodeSeg.Name ); |
|
45 aParameters.Writer.WriteElementString( SegConstants.CmnBase, iCodeSeg.Base.ToString( "x8" ) ); |
|
46 aParameters.Writer.WriteElementString( SegConstants.CmnSize, iCodeSeg.Size.ToString( "x8" ) ); |
|
47 aParameters.Writer.WriteElementString( SegConstants.CmnRange, iCodeSeg.Range.ToString() ); |
|
48 |
|
49 if ( iCodeSeg.Checksum != 0 ) |
|
50 { |
|
51 aParameters.Writer.WriteElementString( SegConstants.CmnChecksum, iCodeSeg.Checksum.ToString( "x8" ) ); |
|
52 } |
|
53 |
|
54 // Write any messages |
|
55 CXmlSegBase.XmlSerializeMessages( aParameters, iCodeSeg ); |
|
56 } |
|
57 |
|
58 protected override void XmlSerializeChildren( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
59 { |
|
60 aParameters.Writer.WriteStartElement( SegConstants.CmnAttributes ); |
|
61 // |
|
62 CodeSegDefinition codeSegDef = (CodeSegDefinition) iCodeSeg; |
|
63 if ( ( codeSegDef.Attributes & CodeSegDefinition.TAttributes.EAttributeXIP ) == CodeSegDefinition.TAttributes.EAttributeXIP ) |
|
64 { |
|
65 aParameters.Writer.WriteElementString( SegConstants.CmnXIP, string.Empty ); |
|
66 } |
|
67 else if ( ( codeSegDef.Attributes & CodeSegDefinition.TAttributes.EAttributeRAM ) == CodeSegDefinition.TAttributes.EAttributeRAM ) |
|
68 { |
|
69 aParameters.Writer.WriteElementString( SegConstants.CmnRAM, string.Empty ); |
|
70 } |
|
71 if ( !iCodeSeg.IsResolved ) |
|
72 { |
|
73 aParameters.Writer.WriteElementString( SegConstants.CodeSegs_CodeSeg_Attributes_NoSymbols, string.Empty ); |
|
74 } |
|
75 if ( iCodeSeg.IsSpeculative ) |
|
76 { |
|
77 aParameters.Writer.WriteElementString( SegConstants.CodeSegs_CodeSeg_Attributes_Speculative, string.Empty ); |
|
78 } |
|
79 if ( iCodeSeg.IsMismatched ) |
|
80 { |
|
81 aParameters.Writer.WriteElementString( SegConstants.CodeSegs_CodeSeg_Attributes_Mismatch, string.Empty ); |
|
82 } |
|
83 // |
|
84 aParameters.Writer.WriteEndElement(); |
|
85 } |
|
86 #endregion |
|
87 |
|
88 #region Properties |
|
89 #endregion |
|
90 |
|
91 #region Data members |
|
92 private readonly CICodeSeg iCodeSeg; |
|
93 #endregion |
|
94 } |
|
95 } |