imgtools/romtools/rombuild/symbolgenerator.h
author Zheng Shen <zheng.shen@nokia.com>
Wed, 13 Oct 2010 16:31:27 +0800
changeset 648 d5a8d436d33b
parent 600 6d08f4a05d93
child 654 7c11c3d8d025
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
#ifndef __SYMBOLSCREATER_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
#define __SYMBOLSCREATER_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
#include <queue>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
#include <fstream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
#include <vector>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
#include <map>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
using namespace std;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
#include <boost/thread/thread.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
#include <boost/thread/condition.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
struct SymGenContext {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
	const char* iFileName ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
	TUint32	iTotalSize ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
	TUint32 iCodeAddress; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
	TUint32 iDataAddress; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
	TUint32 iDataBssLinearBase;	 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
	TInt iTextSize; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
	TInt iDataSize; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
	TInt iBssSize;   	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
	TInt iTotalDataSize;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
	TBool iExecutable ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
class SymbolGenerator  {  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
public :
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
		SymbolGenerator(const char* aSymbolFileName, int aMultiThreadsCount = 1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
		~SymbolGenerator();		
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
		void AddEntry(const SymGenContext& aEntry); 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
		void WaitThreads();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
private :
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
		SymbolGenerator();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
		SymbolGenerator& operator = (const SymbolGenerator& aRight);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
		static void ThreadFunc(SymbolGenerator* aInst); 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
		bool ProcessEntry(const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
		bool ProcessARMV5Map(ifstream& aStream, const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
		bool ProcessGCCMap(ifstream& aStream, const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
		bool ProcessX86Map(ifstream& aStream, const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
		ofstream iOutput ; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
		boost::thread_group iThreads ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
		boost::condition_variable iCond;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
		boost::mutex iQueueMutex;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
		boost::mutex iFileMutex ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
		queue<SymGenContext> iEntries ;	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
		vector<char*> iErrMsgs ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
#endif //__ROMSYMBOLGENERATOR_H__