|
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.IO; |
|
20 using System.Collections.Generic; |
|
21 using System.Text; |
|
22 using System.Text.RegularExpressions; |
|
23 using SymbianStructuresLib.Debug.Symbols; |
|
24 using SymbianSymbolLib.SourceManagement.Source; |
|
25 using SymbianSymbolLib.SourceManagement.Provisioning; |
|
26 using SymbianUtils; |
|
27 using SymbianUtils.FileTypes; |
|
28 using SymbianUtils.Tracer; |
|
29 |
|
30 namespace SLPluginMap.Reader.GCCE |
|
31 { |
|
32 internal class GCCESymbolCreator |
|
33 { |
|
34 #region Constructors |
|
35 public GCCESymbolCreator( MapReader aReader, SymbolCollection aCollection ) |
|
36 { |
|
37 iReader = aReader; |
|
38 iCollection = aCollection; |
|
39 } |
|
40 #endregion |
|
41 |
|
42 #region Properties |
|
43 #endregion |
|
44 |
|
45 #region API |
|
46 public Symbol Parse( string aLine ) |
|
47 { |
|
48 Symbol ret = null; |
|
49 // |
|
50 Match m = KMapParserRegex.Match( aLine ); |
|
51 if ( m.Success ) |
|
52 { |
|
53 GroupCollection groups = m.Groups; |
|
54 // |
|
55 uint globalBaseAddress = iReader.GlobalBaseAddress; |
|
56 string symbol = groups[ "Function" ].Value; |
|
57 uint offsetAddress = uint.Parse( groups[ "Address" ].Value, System.Globalization.NumberStyles.HexNumber ) - globalBaseAddress; |
|
58 // |
|
59 if ( symbol != null ) |
|
60 { |
|
61 symbol = symbol.Trim(); |
|
62 // |
|
63 if ( !string.IsNullOrEmpty( symbol ) ) |
|
64 { |
|
65 if ( symbol.StartsWith( "PROVIDE" ) ) |
|
66 { |
|
67 } |
|
68 else |
|
69 { |
|
70 ret = Symbol.New( iCollection ); |
|
71 ret.OffsetAddress = offsetAddress; |
|
72 ret.Size = 0; |
|
73 ret.Object = string.Empty; |
|
74 ret.Name = symbol; |
|
75 } |
|
76 } |
|
77 } |
|
78 } |
|
79 // |
|
80 return ret; |
|
81 } |
|
82 #endregion |
|
83 |
|
84 #region Internal constants |
|
85 private readonly static Regex KMapParserRegex = new Regex( |
|
86 " 0x(?<Address>[A-Fa-f0-9]{8}) (?<Function>.+)", |
|
87 RegexOptions.Multiline |
|
88 | RegexOptions.CultureInvariant |
|
89 | RegexOptions.Compiled |
|
90 ); |
|
91 #endregion |
|
92 |
|
93 #region Internal methods |
|
94 #endregion |
|
95 |
|
96 #region Data members |
|
97 private readonly MapReader iReader; |
|
98 private readonly SymbolCollection iCollection; |
|
99 #endregion |
|
100 } |
|
101 } |