|
1 /* |
|
2 * Copyright (c) 2010 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 the License "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 #ifndef __SYMBOLPROCESSUNIT_H__ |
|
18 #define __SYMBOLPROCESSUNIT_H__ |
|
19 #include <vector> |
|
20 #include <string> |
|
21 #include <iostream> |
|
22 #include <fstream> |
|
23 |
|
24 #include "bsymutil.h" |
|
25 |
|
26 using namespace std; |
|
27 |
|
28 struct TPlacedEntry{ |
|
29 string iFileName; |
|
30 string iDevFileName; |
|
31 TUint32 iTotalSize; |
|
32 TUint32 iCodeAddress; |
|
33 TUint32 iDataAddress; |
|
34 TUint32 iDataBssLinearBase; |
|
35 TUint32 iTextSize; |
|
36 TUint32 iDataSize; |
|
37 TUint32 iBssSize; |
|
38 TUint32 iTotalDataSize; |
|
39 bool iExecutable; |
|
40 TPlacedEntry(const string& aName, const string& aDevFileName, bool aExecutable) { |
|
41 iFileName = aName; |
|
42 iDevFileName = aDevFileName; |
|
43 iExecutable = aExecutable; |
|
44 } |
|
45 TPlacedEntry() { |
|
46 } |
|
47 }; |
|
48 |
|
49 typedef vector<string> stringlist; |
|
50 |
|
51 class SymbolProcessUnit |
|
52 { |
|
53 public: |
|
54 virtual void ProcessExecutableFile(const string& aFile) = 0; |
|
55 virtual void ProcessDataFile(const string& afile) = 0; |
|
56 virtual void FlushStdOut(ostream& aOut) = 0; |
|
57 virtual void FlushSymbolContent(ostream &aOut) = 0; |
|
58 virtual void ResetContentLog() = 0; |
|
59 virtual ~SymbolProcessUnit() {} |
|
60 virtual void ProcessEntry(const TPlacedEntry& aEntry); |
|
61 int GetSizeFromBinFile( const string& fileName ); |
|
62 }; |
|
63 |
|
64 class CommenRomSymbolProcessUnit : public SymbolProcessUnit |
|
65 { |
|
66 public: |
|
67 virtual void ProcessExecutableFile(const string& aFile); |
|
68 virtual void ProcessDataFile(const string& afile); |
|
69 virtual void FlushStdOut(ostream& aOut); |
|
70 virtual void FlushSymbolContent(ostream &aOut); |
|
71 virtual void ResetContentLog(); |
|
72 virtual void ProcessEntry(const TPlacedEntry& aEntry); |
|
73 private: |
|
74 void ProcessArmv5File( const string& fileName, ifstream& aMap ); |
|
75 void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ); |
|
76 void ProcessX86File( const string& fileName, ifstream& aMap ); |
|
77 private: |
|
78 stringlist iStdoutLog; |
|
79 stringlist iSymbolContentLog; |
|
80 TPlacedEntry iPlacedEntry; |
|
81 }; |
|
82 |
|
83 class CommenRofsSymbolProcessUnit : public SymbolProcessUnit |
|
84 { |
|
85 public: |
|
86 virtual void ProcessExecutableFile(const string& aFile); |
|
87 virtual void ProcessDataFile(const string& afile); |
|
88 virtual void FlushStdOut(ostream& aOut); |
|
89 virtual void FlushSymbolContent(ostream &aOut); |
|
90 virtual void ResetContentLog(); |
|
91 private: |
|
92 void ProcessArmv5File( const string& fileName, ifstream& aMap ); |
|
93 void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ); |
|
94 private: |
|
95 stringlist iStdoutLog; |
|
96 stringlist iSymbolContentLog; |
|
97 }; |
|
98 |
|
99 class SymbolGenerator; |
|
100 |
|
101 class BsymRofsSymbolProcessUnit : public SymbolProcessUnit |
|
102 { |
|
103 public: |
|
104 BsymRofsSymbolProcessUnit(SymbolGenerator* aSymbolGeneratorPtr): iSymbolGeneratorPtr(aSymbolGeneratorPtr){} |
|
105 BsymRofsSymbolProcessUnit(){} |
|
106 virtual void ProcessExecutableFile(const string& aFile); |
|
107 virtual void ProcessDataFile(const string& afile); |
|
108 virtual void FlushStdOut(ostream& aOut); |
|
109 virtual void FlushSymbolContent(ostream &aOut); |
|
110 virtual void ResetContentLog(); |
|
111 virtual void ProcessEntry(const TPlacedEntry& aEntry); |
|
112 private: |
|
113 void ProcessArmv5File( const string& fileName, ifstream& aMap ); |
|
114 void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ); |
|
115 private: |
|
116 stringlist iStdoutLog; |
|
117 MapFileInfo iMapFileInfo; |
|
118 SymbolGenerator* iSymbolGeneratorPtr; |
|
119 }; |
|
120 #endif |