imgtools/imglib/symbolutil/symbolgenerator.cpp
author marvin shi <marvin.shi@nokia.com>
Tue, 30 Nov 2010 17:14:57 +0800
changeset 714 e5a58c351011
parent 695 46ca13b54f56
permissions -rw-r--r--
feature bsym format symbol rombuild support
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
695
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     1
/*
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     8
*
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    11
*
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    12
* Contributors:
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    13
*
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    14
* Description: 
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    15
*
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    16
*/
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    17
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    18
#include <vector>
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    19
#include <boost/regex.hpp>
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    20
#define MAX_LINE 65535
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    21
#include "symbolgenerator.h"
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    22
#include "e32image.h"
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    23
#include "h_utl.h"
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    24
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    25
#if defined(__LINUX__)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    26
#define PATH_SEPARATOR '/'
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    27
#else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    28
#define PATH_SEPARATOR '\\'
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    29
#endif
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    30
extern TInt gThreadNum;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    31
extern TBool gGenBsymbols;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    32
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    33
boost::mutex SymbolGenerator::iMutexSingleton;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    34
SymbolGenerator* SymbolGenerator::iInst = NULL;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    35
SymbolGenerator* SymbolGenerator::GetInstance(){
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    36
    if(iInst == NULL)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    37
    {
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    38
    	iMutexSingleton.lock();
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    39
    	if(iInst == NULL) {
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    40
        	iInst = new SymbolGenerator();
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    41
    	}
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
    42
    	iMutexSingleton.unlock();
695
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    43
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    44
    return iInst;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    45
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    46
void SymbolGenerator::Release() {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    47
    if(iInst != NULL) {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    48
        iInst->join();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    49
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    50
    iMutexSingleton.lock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    51
    if(iInst != NULL) {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    52
        delete iInst;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    53
        iInst = NULL;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    54
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    55
    iMutexSingleton.unlock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    56
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    57
void SymbolGenerator::SetSymbolFileName( const string& fileName ){
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    58
    if(iSymFile.is_open())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    59
        iSymFile.close();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    60
    if(gGenBsymbols)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    61
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    62
    	string s = fileName.substr(0,fileName.rfind('.'))+".bsym";
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    63
    	if(iImageType == ERofsImage)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    64
    	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    65
    		printf("* Writing %s - ROFS BSymbol file\n", s.c_str());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    66
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    67
    	else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    68
    	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    69
    		printf("* Writing %s - ROM BSymbol file\n", s.c_str());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    70
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    71
    	iSymFile.open(s.c_str(), ios_base::binary);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    72
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    73
    else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    74
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    75
    	string s = fileName.substr(0,fileName.rfind('.'))+".symbol";
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    76
    	if(iImageType == ERofsImage)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    77
    	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    78
    		printf("* Writing %s - ROFS Symbol file\n", s.c_str());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    79
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    80
    	else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    81
    	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    82
    		printf("* Writing %s - ROM Symbol file\n", s.c_str());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    83
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    84
    iSymFile.open(s.c_str());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    85
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    86
	   
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    87
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    88
void SymbolGenerator::AddFile( const string& fileName, bool isExecutable ){
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    89
    iMutex.lock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    90
    iQueueFiles.push(TPlacedEntry(fileName, "" , isExecutable));
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    91
    iMutex.unlock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    92
    iCond.notify_all();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    93
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    94
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    95
void SymbolGenerator::AddEntry(const TPlacedEntry& aEntry)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    96
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    97
    iMutex.lock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    98
    iQueueFiles.push(aEntry);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
    99
    iMutex.unlock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   100
    iCond.notify_all();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   101
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   102
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   103
void SymbolGenerator::SetFinished() 
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   104
{ 
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   105
	boost::mutex::scoped_lock lock(iMutex);
695
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   106
	iFinished = true; 
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   107
	iCond.notify_all();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   108
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   109
TPlacedEntry SymbolGenerator::GetNextPlacedEntry()
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   110
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   111
	TPlacedEntry pe("", "", false);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   112
	if(1)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   113
	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   114
		boost::mutex::scoped_lock lock(iMutex);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   115
		while(!iFinished && iQueueFiles.empty())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   116
			iCond.wait(lock);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   117
		if(!iQueueFiles.empty())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   118
		{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   119
			pe = iQueueFiles.front();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   120
			iQueueFiles.pop();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   121
        	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   122
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   123
	return pe;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   124
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   125
void SymbolGenerator::thrd_func(){
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   126
    	boost::thread_group threads;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   127
	SymbolWorker worker;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   128
    	for(int i=0; i < gThreadNum; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   129
    	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   130
    		threads.create_thread(worker);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   131
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   132
    	threads.join_all();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   133
	SymbolGenerator::GetInstance()->FlushSymbolFileContent();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   134
        }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   135
SymbolGenerator::SymbolGenerator() : boost::thread(thrd_func),iFinished(false) {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   136
	if(gGenBsymbols)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   137
	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   138
		iSymbolType = ESymBsym;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   139
	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   140
	else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   141
	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   142
		iSymbolType = ESymCommon;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   143
	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   144
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   145
SymbolGenerator::~SymbolGenerator(){
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   146
    if(joinable())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   147
        join();
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   148
    for(int i=0; i < (int)iLogMessages.size(); i++)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   149
    {
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   150
	    cout << iLogMessages[i];
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   151
    }
695
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   152
    iSymFile.flush();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   153
    iSymFile.close();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   154
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   155
void SymbolGenerator::FlushSymbolFileContent()
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   156
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   157
    if(iSymbolType == ESymCommon)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   158
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   159
	return;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   160
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   161
    TBsymHeader tmpBsymHeader;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   162
    memset(&tmpBsymHeader, 0, sizeof(tmpBsymHeader));
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   163
    tmpBsymHeader.iMagic[0] = 'B';
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   164
    tmpBsymHeader.iMagic[1] = 'S';
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   165
    tmpBsymHeader.iMagic[2] = 'Y';
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   166
    tmpBsymHeader.iMagic[3] = 'M';
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   167
    tmpBsymHeader.iMajorVer[0] = BsymMajorVer >> 8;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   168
    tmpBsymHeader.iMajorVer[1] = BsymMajorVer & 0xff;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   169
    tmpBsymHeader.iMinorVer[0] = BsymMinorVer >> 8;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   170
    tmpBsymHeader.iMinorVer[1] = BsymMinorVer & 0xff;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   171
    if(ByteOrderUtil::IsLittleEndian())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   172
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   173
	    tmpBsymHeader.iEndiannessFlag = 0;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   174
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   175
    else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   176
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   177
	    tmpBsymHeader.iEndiannessFlag = 1;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   178
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   179
    tmpBsymHeader.iCompressionFlag = 1;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   180
    //count the space for TDbgUnitEntries and TSymbolEntries
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   181
    int fileCount = iMapFileInfoSet.size();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   182
    TUint32 sizeNeeded = fileCount * sizeof(TDbgUnitEntry);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   183
    for(int i = 0; i < fileCount; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   184
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   185
    	sizeNeeded += iMapFileInfoSet[i].iSymbolPCEntrySet.size() * sizeof(TSymbolEntry);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   186
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   187
    //write string to the temporary memory area
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   188
    MemoryWriter mWriter;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   189
    mWriter.SetOffset(sizeNeeded);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   190
    mWriter.SetStringTableStart(sizeNeeded);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   191
    mWriter.AddEmptyString();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   192
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   193
    //first to prepare the file info entries TDbgUnitEntry
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   194
    TUint32 startSymbolIndex = 0;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   195
    for(int i = 0; i < fileCount; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   196
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   197
    	iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry.iStartSymbolIndex = startSymbolIndex;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   198
    	iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry.iPCNameOffset = mWriter.AddString(iMapFileInfoSet[i].iDbgUnitPCEntry.iPCName);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   199
    	iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry.iDevNameOffset = mWriter.AddString(iMapFileInfoSet[i].iDbgUnitPCEntry.iDevName);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   200
    	startSymbolIndex += iMapFileInfoSet[i].iSymbolPCEntrySet.size();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   201
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   202
    //second to layout the symbols unit for the mapfile
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   203
    for(int i = 0; i < fileCount; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   204
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   205
        int symbolcount = iMapFileInfoSet[i].iSymbolPCEntrySet.size();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   206
        for(int j =0; j< symbolcount; j++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   207
        {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   208
        	iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry.iScopeNameOffset = mWriter.AddScopeName(iMapFileInfoSet[i].iSymbolPCEntrySet[j].iScopeName);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   209
        	iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry.iNameOffset = mWriter.AddString(iMapFileInfoSet[i].iSymbolPCEntrySet[j].iName);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   210
        	iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry.iSecNameOffset = mWriter.AddString(iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSecName);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   211
        }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   212
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   213
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   214
    //write out the BSym file content
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   215
    char* pstart = mWriter.GetDataPointer();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   216
    //write out the map file info
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   217
    int unitlen = sizeof(TDbgUnitEntry);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   218
    for(int i = 0; i < fileCount; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   219
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   220
    	memcpy(pstart, &iMapFileInfoSet[i].iDbgUnitPCEntry.iDbgUnitEntry, unitlen);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   221
    	pstart += unitlen;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   222
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   223
    //wirte out the symbol unit info
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   224
    unitlen = sizeof(TSymbolEntry);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   225
    for(int i = 0; i < fileCount; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   226
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   227
    	int symbolcount = iMapFileInfoSet[i].iSymbolPCEntrySet.size();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   228
    	for(int j =0; j < symbolcount; j++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   229
    	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   230
    		memcpy(pstart, &iMapFileInfoSet[i].iSymbolPCEntrySet[j].iSymbolEntry, unitlen);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   231
    		pstart += unitlen;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   232
    	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   233
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   234
    //write out the memory out to the symbol file
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   235
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   236
    int totalPages = (mWriter.GetOffset() + ( BSYM_PAGE_SIZE -1)) / 4096;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   237
    TUint32 compressInfoLength = sizeof(TCompressedHeaderInfo) + sizeof(TPageInfo)*(totalPages -1);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   238
    char* tmpBuffer = new char[compressInfoLength];
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   239
    TCompressedHeaderInfo * pCompressedHeaderInfo = (TCompressedHeaderInfo *) tmpBuffer;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   240
    pCompressedHeaderInfo->iPageSize = BSYM_PAGE_SIZE;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   241
    pCompressedHeaderInfo->iTotalPageNumber = totalPages;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   242
    TPageInfo* tmpPage = &pCompressedHeaderInfo->iPages[0];
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   243
    for(int i = 0; i < totalPages; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   244
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   245
	    tmpPage->iPageStartOffset = i * BSYM_PAGE_SIZE;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   246
	    if(tmpPage->iPageStartOffset + BSYM_PAGE_SIZE < mWriter.GetOffset())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   247
	    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   248
	    	tmpPage->iPageDataSize = BSYM_PAGE_SIZE;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   249
	    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   250
	    else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   251
	    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   252
		tmpPage->iPageDataSize = mWriter.GetOffset() - tmpPage->iPageStartOffset;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   253
	    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   254
	    tmpPage++;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   255
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   256
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   257
    //prepare the TBsymHeader, TDbgUnitEntry and TSymbolEntry to the memory
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   258
    tmpBsymHeader.iDbgUnitOffset = sizeof(TBsymHeader) + compressInfoLength;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   259
    tmpBsymHeader.iDbgUnitCount = fileCount;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   260
    tmpBsymHeader.iSymbolOffset = fileCount*sizeof(TDbgUnitEntry);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   261
    tmpBsymHeader.iSymbolCount = startSymbolIndex;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   262
    tmpBsymHeader.iStringTableOffset = mWriter.GetStringTableStart();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   263
    tmpBsymHeader.iStringTableBytes = mWriter.GetOffset() - tmpBsymHeader.iStringTableOffset;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   264
    tmpBsymHeader.iUncompressSize = mWriter.GetOffset();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   265
    //start the compress threads
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   266
    Print(EAlways, "Start compress for Bsymbol file\n");
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   267
    PageCompressWorker compressWorker(pCompressedHeaderInfo, mWriter.GetDataPointer());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   268
    boost::thread_group threads;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   269
    for(int i=0; i < gThreadNum; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   270
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   271
	    threads.create_thread(compressWorker);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   272
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   273
    threads.join_all();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   274
    Print(EAlways, "Complete compress for Bsymbol file\n");
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   275
    //pack all the pages together
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   276
    tmpPage = &pCompressedHeaderInfo->iPages[0];
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   277
    TPageInfo* prePage = NULL;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   278
    char* pchar = mWriter.GetDataPointer();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   279
    for(int i=0; i < totalPages -1; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   280
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   281
	    prePage = tmpPage;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   282
	    tmpPage++;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   283
	    memcpy(pchar + prePage->iPageStartOffset + prePage->iPageDataSize, pchar + tmpPage->iPageStartOffset, tmpPage->iPageDataSize);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   284
	    tmpPage->iPageStartOffset = prePage->iPageStartOffset + prePage->iPageDataSize;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   285
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   286
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   287
    tmpBsymHeader.iCompressedSize = tmpPage->iPageStartOffset + tmpPage->iPageDataSize;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   288
    mWriter.SetOffset(tmpBsymHeader.iCompressedSize);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   289
    tmpBsymHeader.iCompressInfoOffset = sizeof(TBsymHeader);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   290
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   291
    iSymFile.write((char*)&tmpBsymHeader, sizeof(TBsymHeader));
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   292
    iSymFile.write((char*)pCompressedHeaderInfo, compressInfoLength);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   293
    iSymFile.write(mWriter.GetDataPointer(), mWriter.GetOffset());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   294
    delete[] tmpBuffer;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   295
    for(int i = 0; i < fileCount; i++)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   296
    {
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   297
    	iMapFileInfoSet[i].iSymbolPCEntrySet.clear();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   298
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   299
    iMapFileInfoSet.clear();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   300
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   301
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   302
SymbolWorker::SymbolWorker()
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   303
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   304
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   305
SymbolWorker::~SymbolWorker()
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   306
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   307
    }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   308
void SymbolWorker::operator()()
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   309
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   310
	SymbolProcessUnit* aSymbolProcessUnit;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   311
	SymbolGenerator* symbolgenerator = SymbolGenerator::GetInstance();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   312
	if(symbolgenerator->GetImageType() == ERomImage)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   313
	{
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   314
		if(gGenBsymbols)
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   315
		{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   316
			aSymbolProcessUnit = new BsymRomSymbolProcessUnit(symbolgenerator);
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   317
		}
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   318
		else
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   319
		{
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   320
			aSymbolProcessUnit = new CommenRomSymbolProcessUnit();
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   321
		}
695
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   322
	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   323
	else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   324
	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   325
		if(gGenBsymbols)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   326
		{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   327
			aSymbolProcessUnit = new BsymRofsSymbolProcessUnit(symbolgenerator);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   328
		}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   329
		else
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   330
		{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   331
			aSymbolProcessUnit = new CommenRofsSymbolProcessUnit();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   332
		}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   333
	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   334
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   335
	while(1)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   336
	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   337
		if(symbolgenerator->HasFinished() && symbolgenerator->IsEmpty())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   338
		{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   339
			break;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   340
                }
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   341
		TPlacedEntry pe = symbolgenerator->GetNextPlacedEntry();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   342
		if(pe.iFileName.empty())
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   343
			continue;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   344
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   345
		aSymbolProcessUnit->ProcessEntry(pe);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   346
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   347
		symbolgenerator->LockOutput();
714
e5a58c351011 feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents: 695
diff changeset
   348
		aSymbolProcessUnit->FlushStdOut(symbolgenerator->iLogMessages);
695
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   349
		aSymbolProcessUnit->FlushSymbolContent(symbolgenerator->GetOutputFileStream());
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   350
		symbolgenerator->UnlockOutput();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   351
	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   352
	delete aSymbolProcessUnit;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   353
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   354
TCompressedHeaderInfo* PageCompressWorker::pHeaderInfo = NULL;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   355
int PageCompressWorker::currentPage = 0;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   356
boost::mutex PageCompressWorker::m_mutex;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   357
int PageCompressWorker::m_error = 0;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   358
char* PageCompressWorker::iChar = NULL;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   359
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   360
PageCompressWorker::PageCompressWorker(TCompressedHeaderInfo* aHeaderInfo, char* aChar) 
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   361
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   362
	pHeaderInfo = aHeaderInfo;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   363
	iChar = aChar;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   364
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   365
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   366
PageCompressWorker::~PageCompressWorker() {}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   367
void PageCompressWorker::operator()()
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   368
{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   369
	int tobecompress = 0;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   370
	CBytePair bpe;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   371
	while(1)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   372
	{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   373
		m_mutex.lock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   374
		tobecompress =currentPage;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   375
		currentPage++;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   376
		m_mutex.unlock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   377
		if(tobecompress >= (int) pHeaderInfo->iTotalPageNumber)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   378
			break;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   379
		TPageInfo* current = &pHeaderInfo->iPages[0] + tobecompress;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   380
		TUint8* in = (TUint8*)(iChar + current->iPageStartOffset);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   381
		TUint8* out = in;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   382
		TInt outSize = BytePairCompress(out, in, current->iPageDataSize, &bpe);
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   383
		if(outSize == KErrTooBig)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   384
		{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   385
			outSize = BSYM_PAGE_SIZE;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   386
		}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   387
		if(outSize < 0)
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   388
		{
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   389
			m_mutex.lock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   390
			m_error = -1;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   391
			m_mutex.unlock();
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   392
			break;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   393
		}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   394
		current->iPageDataSize = outSize;
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   395
	}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   396
	
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   397
}
46ca13b54f56 features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff changeset
   398