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 |
|
18 #ifndef __SYMBOLSCREATER_H__ |
|
19 #define __SYMBOLSCREATER_H__ |
|
20 #include <queue> |
|
21 #include <string> |
|
22 #include <fstream> |
|
23 #include <vector> |
|
24 #include <map> |
|
25 |
|
26 using namespace std; |
|
27 |
|
28 #include <boost/thread/thread.hpp> |
|
29 #include <boost/thread/condition.hpp> |
|
30 |
|
31 struct SymGenContext { |
|
32 const char* iFileName ; |
|
33 TUint32 iTotalSize ; |
|
34 TUint32 iCodeAddress; |
|
35 TUint32 iDataAddress; |
|
36 TUint32 iDataBssLinearBase; |
|
37 TInt iTextSize; |
|
38 TInt iDataSize; |
|
39 TInt iBssSize; |
|
40 TInt iTotalDataSize; |
|
41 TBool iExecutable ; |
|
42 }; |
|
43 |
|
44 class SymbolGenerator { |
|
45 public : |
|
46 SymbolGenerator(const char* aSymbolFileName, int aMultiThreadsCount = 1); |
|
47 ~SymbolGenerator(); |
|
48 void AddEntry(const SymGenContext& aEntry); |
|
49 void WaitThreads(); |
|
50 private : |
|
51 SymbolGenerator(); |
|
52 SymbolGenerator& operator = (const SymbolGenerator& aRight); |
|
53 static void ThreadFunc(SymbolGenerator* aInst); |
|
54 bool ProcessEntry(const SymGenContext& aContext); |
|
55 bool ProcessARMV5Map(ifstream& aStream, const SymGenContext& aContext); |
|
56 bool ProcessGCCMap(ifstream& aStream, const SymGenContext& aContext); |
|
57 bool ProcessX86Map(ifstream& aStream, const SymGenContext& aContext); |
|
58 ofstream iOutput ; |
|
59 boost::thread_group iThreads ; |
|
60 boost::condition_variable iCond; |
|
61 boost::mutex iQueueMutex; |
|
62 boost::mutex iFileMutex ; |
|
63 queue<SymGenContext> iEntries ; |
|
64 vector<char*> iErrMsgs ; |
|
65 |
|
66 }; |
|
67 |
|
68 #endif //__ROMSYMBOLGENERATOR_H__ |
|