|
1 /* |
|
2 * Copyright (c) 2004-2008 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 using System; |
|
19 using System.Collections.Generic; |
|
20 using System.Text; |
|
21 using SymbianParserLib.Engine; |
|
22 using CrashDebuggerLib.Structures.DebugMask; |
|
23 using SymbianParserLib.Elements; |
|
24 |
|
25 namespace CrashDebuggerLib.Parsers.State.Implementation |
|
26 { |
|
27 internal class StateInfoDebugMask : State |
|
28 { |
|
29 #region Constructors |
|
30 public StateInfoDebugMask( CrashDebuggerParser aParser ) |
|
31 : base( aParser ) |
|
32 { |
|
33 } |
|
34 #endregion |
|
35 |
|
36 #region API |
|
37 public override void Prepare() |
|
38 { |
|
39 PrepareMandatoryParagraph(); |
|
40 } |
|
41 |
|
42 public override void Finalise() |
|
43 { |
|
44 System.Diagnostics.Debug.Assert( ParserEngine.Count == 1 ); // paragraphs |
|
45 ParserParagraph para = ParserEngine[ 0 ]; |
|
46 System.Diagnostics.Debug.Assert( para.Count == 8 ); // lines |
|
47 |
|
48 // Go through each line and pull out the debug mask. |
|
49 for ( int i = 0; i < 4; i++ ) |
|
50 { |
|
51 int baseIndex = ( i * 2 ); |
|
52 |
|
53 // Get lines and check that each has one field |
|
54 ParserLine line1 = para[ baseIndex ]; |
|
55 System.Diagnostics.Debug.Assert( line1.Count == 1 ); |
|
56 System.Diagnostics.Debug.Assert( line1[ 0 ].IsUint ); |
|
57 ParserLine line2 = para[ baseIndex + 1 ]; |
|
58 System.Diagnostics.Debug.Assert( line2.Count == 1 ); |
|
59 System.Diagnostics.Debug.Assert( line2[ 0 ].IsUint ); |
|
60 // |
|
61 uint val1 = line1[ 0 ].AsUint; |
|
62 uint val2 = line2[ 0 ].AsUint; |
|
63 ulong combined = val1 + ( val2 << 32 ); |
|
64 // |
|
65 CrashDebugger.InfoDebugMask.SetValueByWordIndex( combined, baseIndex ); |
|
66 } |
|
67 } |
|
68 #endregion |
|
69 |
|
70 #region Properties |
|
71 #endregion |
|
72 |
|
73 #region Internal methods |
|
74 private void PrepareMandatoryParagraph() |
|
75 { |
|
76 ParserParagraph para = new ParserParagraph( "Debug_Mask_Info" ); |
|
77 // |
|
78 ParserLine l1 = ParserLine.NewSymFormat( "DebugMask[0] = %08x\r\n" ); |
|
79 ParserLine l2 = ParserLine.NewSymFormat( "DebugMask[1] = %08x\r\n" ); |
|
80 ParserLine l3 = ParserLine.NewSymFormat( "DebugMask[2] = %08x\r\n" ); |
|
81 ParserLine l4 = ParserLine.NewSymFormat( "DebugMask[3] = %08x\r\n" ); |
|
82 ParserLine l5 = ParserLine.NewSymFormat( "DebugMask[4] = %08x\r\n" ); |
|
83 ParserLine l6 = ParserLine.NewSymFormat( "DebugMask[5] = %08x\r\n" ); |
|
84 ParserLine l7 = ParserLine.NewSymFormat( "DebugMask[6] = %08x\r\n" ); |
|
85 ParserLine l8 = ParserLine.NewSymFormat( "DebugMask[7] = %08x\r\n" ); |
|
86 para.Add( l1, l2, l3, l4, l5, l6, l7, l8 ); |
|
87 ParserEngine.Add( para ); |
|
88 } |
|
89 #endregion |
|
90 |
|
91 #region Data members |
|
92 #endregion |
|
93 } |
|
94 } |