author | Jussi Ryoma <ext-jussi.s.ryoma@nokia.com> |
Fri, 27 Aug 2010 12:21:46 +0300 | |
changeset 3 | 045ade241ef5 |
parent 0 | 818e61de6cd1 |
permissions | -rw-r--r-- |
0
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
17 |
using System; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
18 |
using System.IO; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
19 |
using System.Text; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
20 |
using System.Text.RegularExpressions; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
21 |
using System.Collections.Generic; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
22 |
|
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
23 |
namespace SymbianStructuresLib.CodeSegments |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
24 |
{ |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
25 |
public static class CodeSegDefinitionParser |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
26 |
{ |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
27 |
#region API |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
28 |
public static CodeSegDefinition ParseDefinition( string aLine ) |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
29 |
{ |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
30 |
CodeSegDefinition ret = null; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
31 |
// |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
32 |
Match m = KCodeSegRegEx.Match( aLine ); |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
33 |
if ( m.Success ) |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
34 |
{ |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
35 |
ret = new CodeSegDefinition(); |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
36 |
// |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
37 |
string gpAddressStart = m.Groups[ "StartAddress" ].Value; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
38 |
string gpAddressEnd = m.Groups[ "EndAddress" ].Value; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
39 |
string gpBinary = m.Groups[ "Binary" ].Value; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
40 |
// |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
41 |
ret.Base = uint.Parse( gpAddressStart, System.Globalization.NumberStyles.HexNumber ); |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
42 |
ret.Limit = uint.Parse( gpAddressEnd, System.Globalization.NumberStyles.HexNumber ); |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
43 |
ret.FileName = gpBinary; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
44 |
} |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
45 |
// |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
46 |
return ret; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
47 |
} |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
48 |
#endregion |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
49 |
|
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
50 |
#region Properties |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
51 |
#endregion |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
52 |
|
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
53 |
#region Internal constants |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
54 |
private static readonly Regex KCodeSegRegEx = new Regex( |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
55 |
@"(?<StartAddress>[a-fA-F0-9]{8})-(?<EndAddress>[a-fA-F0-9]{8})\s{1}(?<Binary>.+)", |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
56 |
RegexOptions.IgnoreCase |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
57 |
); |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
58 |
private const int KBaseHex = 16; |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
59 |
#endregion |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
60 |
|
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
61 |
#region Data members |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
62 |
#endregion |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
63 |
} |
818e61de6cd1
Add initial version of Crash Analyser cmdline under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
64 |
} |