# HG changeset patch # User marvin shi # Date 1289983643 -28800 # Node ID c3fbb20e86f0d876e840fa25f3ddc1a1a998fde6 # Parent 1dfff72f0961700ece2cc365376680b1dc284bab features: bsym for rofsbuild and log input support for rombuild diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/imglib/compress/byte_pair.cpp --- a/imgtools/imglib/compress/byte_pair.cpp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/imglib/compress/byte_pair.cpp Wed Nov 17 16:47:23 2010 +0800 @@ -636,3 +636,12 @@ memcpy(dst,PakBuffer,compressedSize); return compressedSize; } +TInt BytePairDecompress(TUint8* dst, TUint8* src, TInt size, CBytePair *aBPE) +{ + TUint8 UnpakBuffer[MaxBlockSize]; + ASSERT(size<=MaxBlockSize); + TUint8* pakEnd; + TInt us = aBPE->Decompress(UnpakBuffer,MaxBlockSize,src,size,pakEnd); + memcpy(dst,UnpakBuffer,us); + return us; +} diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/imglib/compress/byte_pair.h --- a/imgtools/imglib/compress/byte_pair.h Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/imglib/compress/byte_pair.h Wed Nov 17 16:47:23 2010 +0800 @@ -343,6 +343,7 @@ TInt Decompress(TUint8* dst, TInt dstSize, TUint8* src, TInt srcSize, TUint8*& srcNext); }; TInt BytePairCompress(TUint8* dst, TUint8* src, TInt size, CBytePair *aBPE); +TInt BytePairDecompress(TUint8* dst, TUint8* src, TInt size, CBytePair *aBPE); #endif diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/group/release.txt --- a/imgtools/romtools/group/release.txt Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/group/release.txt Wed Nov 17 16:47:23 2010 +0800 @@ -1,7 +1,13 @@ -Version 2.16.3 (ROFSBUILD) + +Version 2.19.0 (ROMBUILD) =============== -Released by Marvin Shi 17/11/2010 - 1) Fix ou1cimx1#651819 rofsbiuld fails to generate correct log info when using multi-thread +Released by Marvin Shi, 17/11/2010 + 1) feature symbol file generation from log file + +Version 2.17.0 (ROFSBUILD) +=============== +Released by Marvin Shi, 17/11/2010 + 1) feature bsym format symbol file generation for rofsbuild Version 2.16.2 (ROFSBUILD) =============== diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/maksym/maksym.pl --- a/imgtools/romtools/maksym/maksym.pl Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/maksym/maksym.pl Wed Nov 17 16:47:23 2010 +0800 @@ -19,6 +19,7 @@ no strict 'vars'; use English; use FindBin; # for FindBin::Bin +use File::Copy; # Version my $MajorVersion = 1; @@ -47,285 +48,16 @@ # sub main() { - my $file; - my $mapfile; - my $mapfile2; - my $text; - my $data; - my $bss; - my $textsize; - my $datasize; - my $bsssize; - my $totaldatasize; - my $totalsize; - - open (ROM, "<$rombuild") - or die "ERROR: Can't open rombuild log file \"$rombuild\"\n"; - if ($maksym ne "") { - open (SYM, ">$maksym") - or die "ERROR: Can't open output file \"$maksym\"\n"; - print "Creating $maksym...\n"; - } - - while () { - # Start of ROM - if (/^Creating Rom image (\S*)/) { - if ($maksym eq "") { - # For backwards compatibility, replace trailing .img with .symbol - # if no trailing .img, just append .symbol anyway - $maksym = $1; - $maksym =~ s/(\.img)?$/.symbol/i; - close SYM; - open (SYM, ">$maksym") - or die "ERROR: Can't open output file \"$maksym\"\n"; - print "\nCreating $maksym...\n"; - } - next; - } - # end of ROM - if (/^Writing Rom image/) { - close SYM; - $maksym = ""; - next; - } - # Data file - if (/^Reading resource (.*) to rom linear address (.*)/) { - $file = $1; - my $data = hex($2); - $file =~ /([^\\]+)$/; - printf SYM "\nFrom $file\n\n%08x 0000 $1\n", $data; - } - # Executable file - elsif (/^Processing file (.*)/) { - $file = $1; - $text = 0; - $data = 0; - $bss = 0; - $textsize = 0; - $datasize = 0; - $bsssize = 0; - $totaldatasize = 0; - - # Work out final addresses of sections - while (defined($_=) && !/^$/) { - if (/^Size:\s+(\w+)/) { - $totalsize = hex($1); - } elsif (/^Code start addr:\s+(\w+)/) { - $text = hex($1); - } elsif (/^Data start addr:\s+(\w+)/) { - $data = hex($1); - } elsif (/^DataBssLinearBase:\s+(\w+)/) { - $bss = hex($1); - } elsif (/^Text size:\s+(\w+)/) { - $textsize = hex($1); - } elsif (/^Data size:\s+(\w+)/) { - $datasize = hex($1); - } elsif (/^Bsssize:\s+(\w+)/) { - $bsssize = hex($1); - } elsif (/^Total data size:\s+(\w+)/) { - $totaldatasize = hex($1); - } - } - - # Sanity check - text section can't be zero - die "ERROR: Can't find rombuild info for \"$file\"\n" - if (!$text); - - print SYM "\nFrom $file\n\n"; + my $symbolfile = $rombuild; + $symbolfile =~ s/\.log$/\.symbol/i; + my @cmdres = `rombuild -loginput=$rombuild`; + print "@cmdres\n"; - # Look in map file for symbols in .text and relocate them - $mapfile2 = $file.".map"; - $mapfile = $file; - $mapfile =~ s/\.\w+$/\.map/; - if (!(open (MAP, "$mapfile2") || open (MAP, "$mapfile"))) { - print "$file\nWarning: Can't open \"$mapfile2\" or \"$mapfile\"\n"; - $file =~ /([^\\]+)$/; - printf SYM "%08x %04x $1\n", $text, $totalsize; - } else { - local $/ = undef; - my (@maplines) = split(/\n/, ); - close MAP; - # See if we're dealing with the RVCT output - if ($maplines[0] =~ /^ARM Linker/) { - print "$file\n"; - - my %syms; - my @hasharray; - # Starts from begining of map file. - while (@maplines) { - $_ = shift @maplines; - if (/Global Symbols/) { - last; - } elsif (!/(ARM Code|Thumb Code)/) { - next; - } - # name address type size section - if (/^\s*(.+)\s*(0x\S+)\s+(ARM Code|Thumb Code)\s+[^\d]*(\d+)\s+(.*)$/) { - # Check for static methods in local symbols section. - my $sym = $1; - my $addr = hex($2); - my $size = sprintf("%04x",$4); - my $section = $5; - $size = sprintf("%04x", 8) if ($section =~ /\(StubCode\)/); - if(exists($syms{$addr})) { - push @{ $syms{$addr} }, "$size $sym $section"; - } - elsif ($addr > 0){ - @hasharray = "$size $sym $section"; - $syms{$addr} = [@hasharray]; - } - } - } - - foreach (@maplines) { - # name address ignore size section - if (/^\s*(.+)\s*(0x\S+)\s+[^\d]*(\d+)\s+(.*)$/) { - my $sym = $1; - my $addr = hex($2); - my $size = sprintf("%04x",$3); - my $section = $4; - $size = sprintf("%04x", 8) if ($section =~ /\(StubCode\)/); - if(exists($syms{$addr})) { - push @{ $syms{$addr} }, "$size $sym $section"; - } - elsif ($addr > 0) { - @hasharray = "$size $sym $section"; - $syms{$addr} = [@hasharray]; - } - } - } # end of foreach - - # .text gets linked at 0x00008000 - # .data gets linked at 0x00400000 - my $srctext = hex(8000); - my $srcdata = hex(400000); - my $j; - # Write symbols in address order - my @addrs = sort CompareAddrs keys %syms; - for ($i = 0; $i < @addrs ; $i++) { - my $thisaddr = $addrs[$i]; - my $romaddr = 0; - # see if its in the text segment - if ($thisaddr >= $srctext && $thisaddr <= ($srctext+$textsize)) { - $romaddr = $thisaddr-$srctext+$text; - } elsif ( $data && ( $thisaddr >= $srcdata && $thisaddr <= ($srcdata+$datasize))) { - # its in the data segment - # is it from .data or .bss - - # confusingly (?) $bss is the right value to use here - # since we're interested in where the data gets copied to - # in RAM rather than where it sits in ROM - $romaddr = $thisaddr-$srcdata+$bss; - } elsif ( $bss && ( $thisaddr >= $srcdata && $thisaddr <= ($srcdata+$totaldatasize))) { - # its BSS - $romaddr = $thisaddr-$srcdata+$bss; - } else { - my $errsym = $syms{$thisaddr}[0]; - my $erraddr = sprintf("%08x", $thisaddr); - print "WARNING: Symbol $errsym @ $erraddr not in text or data segments\n"; - print "WARNING: The map file for binary $file is out-of-sync with the binary itself\n\n"; - next; - } - - printf SYM "%08x %s\n", $romaddr, $_ for @{$syms{$addrs[$i]}}; - } # end of for. - # See if we're dealing with the GCC output - } elsif ($maplines[0] =~ /^Archive member included/) { - - my $imgtext; - my $textlen; - my %syms; - my $stubhex=1; - - # Find text section - while (@maplines) { - $_ = shift @maplines; - last if /^\.text\s+/; - } - - /^\.text\s+(\w+)\s+(\w+)/ - or die "ERROR: Can't get .text section info for \"$file\"\n"; - - $imgtext=hex($1); - $textlen=hex($2); - - print "$file\n"; - - # Slurp symbols 'til the end of the text section - foreach (@maplines) { - - # blank line marks the end of the text section - last if (/^$/); - - # .text - # .text$something - # - # LONG 0x0 - - if (/^\s(\.text)?\s+(0x\w+)\s+(0x\w+)\s+(.*)$/io) { - my $address = hex($2); - my $length = hex($3); - my $libraryfile = $4; - next if ($libraryfile =~ /^LONG 0x/); - $syms{$address+$length} = ' '; # impossible symbol as end marker - - # EUSER.LIB(ds01423.o) - # EUSER.LIB(C:/TEMP/d1000s_01423.o) - if ($libraryfile =~ /.*lib\(.*d\d*s_?\d{5}.o\)$/io) { - $stubhex=$address; - } - next; - } - - # - if (/^\s+(\w+)\s\s+([a-zA-Z_].+)/o) { - my $addr = hex($1); - my $symbol = $2; - $symbol = "stub $symbol" if ($addr == $stubhex); - $syms{$addr} = $symbol; - next; - } - } - - # Write symbols in address order - @addrs = sort CompareAddrs keys %syms; - for ($i = 0; $i < @addrs - 1; $i++) { - my $symbol = $syms{$addrs[$i]}; - next if ($symbol eq ' '); - printf SYM "%08x %04x %s\n", - $addrs[$i]-$imgtext+$text, $addrs[$i+1]-$addrs[$i], $symbol; - } - # last address assumed to be imgtext+lentext - - close MAP; - } - # Must be x86 output - else { - while (@maplines) { - $_ = shift @maplines; - last if /^ Address/; - } - shift @maplines; - - my ($lastname, $lastaddr); - while (@maplines) { - $_ = shift @maplines; - last unless /^ 0001:(\w+)\s+(\S+)/; - my ($addr, $name) = (hex $1, $2); - if ($lastname) { - my $size = $addr - $lastaddr; - printf SYM "%08x %04x %s\n", $lastaddr + $text, $size, $lastname; - } - ($lastname, $lastaddr) = ($name, $addr); - } - printf SYM "%08x %04x %s\n", $lastaddr + $text, 0, $lastname if $lastname; - } - - } - } - } - close SYM; - close ROM; + if(($maksym ne "") && ($maksym ne $symbolfile)) + { + copy($symbolfile, $maksym); + unlink $symbolfile; + } } # diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rofsbuild/r_build.cpp --- a/imgtools/romtools/rofsbuild/r_build.cpp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rofsbuild/r_build.cpp Wed Nov 17 16:47:23 2010 +0800 @@ -59,9 +59,6 @@ #include "cache/cachemanager.hpp" #include "uniconv.hpp" - -#define MAX_LINE 65535 - extern TUint checkSum(const void* aPtr); extern ECompression gCompress; @@ -628,7 +625,7 @@ if(offset > 0xFFFF) { - printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (unsigned int)offset); + printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (int)offset); throw "fail"; } @@ -643,7 +640,7 @@ TUint32 offset = ((((TUint8*) entry) - dirBlockBase) >> 2); if(offset > 0xFFFF) { - printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (unsigned int)offset); + printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, (int)offset); throw "fail"; } @@ -793,18 +790,7 @@ iNextNodeForSameFile = aPreviousNode; } -void TRomNode::FlushLogMessages() -{ - if(iEntry) - { - for(int i=0; i < (int) iEntry->iLogMessages.size(); i++) - { - std::string& log = iEntry->iLogMessages[i]; - Print(ELog, log.c_str()); - } - iEntry->iLogMessages.clear(); - } -} + @@ -877,12 +863,9 @@ TInt TRomBuilderEntry::PlaceFile( TUint8* &aDest,TUint aMaxSize, CBytePair *aBPE ){ - char tmpbuf[MAX_LINE]; TUint compression = 0; TBool executable = iExecutable; - sprintf(tmpbuf,"Reading file %s to image\n", iFileName ); - iLogMessages.push_back(tmpbuf); - + Print(ELog,"Reading file %s to image\n", iFileName ); TUint32 size = HFile::GetLength(iFileName); if (size==0) Print(EWarning, "File %s does not exist or is 0 bytes in length.\n",iFileName); @@ -1087,14 +1070,12 @@ if( newFileComp == 0) { - sprintf(tmpbuf,"Decompressing executable '%s'\n", iFileName); - iLogMessages.push_back(tmpbuf); + Print(ELog,"Decompressing executable '%s'\n", iFileName); f.iHdr->iCompressionType = 0; } else { - sprintf(tmpbuf,"Compressing executable '%s' with method:%08x\n", iFileName, (unsigned int)newFileComp); - iLogMessages.push_back(tmpbuf); + Print(ELog,"Compressing executable '%s' with method:%08x\n", iFileName, newFileComp); f.iHdr->iCompressionType = newFileComp; } f.UpdateHeaderCrc(); @@ -1143,12 +1124,11 @@ compression = atoi(entryref->GetCachedFileCompressionID()); memcpy(&iUids[0], aDest, sizeof(iUids)); if (compression) - sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int)compression); + Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression); else if (iExecutable) - sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int)size); + Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size); else - sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size); - iLogMessages.push_back(tmpbuf); + Print(ELog,"File '%s' size: %08x\n", iFileName, size); iRealFileSize = size; // required later when directory is written return size; @@ -1226,12 +1206,11 @@ } if (compression) - sprintf(tmpbuf,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, (unsigned int) size, (unsigned int) compression); + Print(ELog,"Compressed executable File '%s' size: %08x, mode:%08x\n", iFileName, size, compression); else if (iExecutable) - sprintf(tmpbuf,"Executable File '%s' size: %08x\n", iFileName, (unsigned int) size); + Print(ELog,"Executable File '%s' size: %08x\n", iFileName, size); else - sprintf(tmpbuf,"File '%s' size: %08x\n", iFileName, (unsigned int) size); - iLogMessages.push_back(tmpbuf); + Print(ELog,"File '%s' size: %08x\n", iFileName, size); iCompressEnabled = compression; iRealFileSize = size; // required later when directory is written @@ -1372,3 +1351,11 @@ } } +char* TRomBuilderEntry::GetSystemFullName() +{ + TBool aIgnoreHiddenAttrib = ETrue; + TInt aLen = iRomNode->FullNameLength(aIgnoreHiddenAttrib); + char *aBuf = new char[aLen+1]; + iRomNode->GetFullName(aBuf, aIgnoreHiddenAttrib); + return aBuf; +} diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rofsbuild/r_rofs.cpp --- a/imgtools/romtools/rofsbuild/r_rofs.cpp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rofsbuild/r_rofs.cpp Wed Nov 17 16:47:23 2010 +0800 @@ -32,6 +32,7 @@ extern TBool gLowMem; extern TInt gThreadNum; extern TBool gGenSymbols; +extern TBool gGenBsymbols; //////////////////////////////////////////////////////////////////////// @@ -49,8 +50,10 @@ // : iObey( aObey ), iOverhead(0) { - if(gGenSymbols) + if(gGenSymbols || gGenBsymbols) { iSymGen = SymbolGenerator::GetInstance(); + iSymGen->SetImageType(ERofsImage); + } else iSymGen = NULL; @@ -263,7 +266,6 @@ } class Worker : public boost::thread { public: - static boost::mutex iOutputMutex; static void thrd_func(E32Rofs* rofs){ CBytePair bpe; @@ -274,9 +276,12 @@ p->len = p->node->PlaceFile(p->buf, (TUint32)-1, 0, &bpe); //no symbol for hidden file if(rofs->iSymGen && !p->node->iEntry->iHidden) - rofs->iSymGen->AddFile(p->node->iEntry->iFileName,(p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable)); - boost::mutex::scoped_lock lock(iOutputMutex); - p->node->FlushLogMessages(); + { + char* fullsystemname= p->node->iEntry->GetSystemFullName(); + TPlacedEntry tmpEntry(p->node->iEntry->iFileName, fullsystemname, (p->node->iEntry->iCompressEnabled|| p->node->iEntry->iExecutable)); + rofs->iSymGen->AddEntry(tmpEntry); + delete[] fullsystemname; + } } p = rofs->GetFileNode(deferred); } @@ -284,9 +289,6 @@ p = rofs->GetDeferredJob(); while(p) { p->len = p->node->PlaceFile(p->buf, (TUint32)-1, 0, &bpe); - iOutputMutex.lock(); - p->node->FlushLogMessages(); - iOutputMutex.unlock(); p = rofs->GetDeferredJob(); } } @@ -294,8 +296,6 @@ } }; -boost::mutex Worker::iOutputMutex; - TPlacingSection* E32Rofs::GetFileNode(bool &aDeferred) { //get a node from the node list, the node list is protected by mutex iMuxTree. //The iMuxTree also helps to make sure the order in iVPS is consistent with the node list. diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rofsbuild/r_romnode.h --- a/imgtools/romtools/rofsbuild/r_romnode.h Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rofsbuild/r_romnode.h Wed Nov 17 16:47:23 2010 +0800 @@ -20,8 +20,6 @@ #define __R_ROMNODE_H__ #include -#include -#include #include #include "rofs.h" #include "e32image.h" @@ -125,8 +123,7 @@ TInt GetFullName(char* aBuf, TBool aIgnoreHiddenAttrib = EFalse) const; static void InitializeCount(); // Accessor Function. - inline TRomNode* GetParent() const { return iParent; } - void FlushLogMessages(); + inline TRomNode* GetParent() const { return iParent; } private: void Remove(TRomNode* aChild); @@ -202,6 +199,7 @@ inline TInt RealFileSize() const { return iRealFileSize; }; inline void SetRealFileSize(TInt aFileSize) { iRealFileSize=aFileSize;}; void DisplaySize(TPrintType aWhere); + char* GetSystemFullName(); private: TRomBuilderEntry(); @@ -212,7 +210,6 @@ public: char *iName; char *iFileName; - std::vector iLogMessages; TRomBuilderEntry* iNext; TRomBuilderEntry* iNextInArea; diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rofsbuild/rofsbuild.cpp --- a/imgtools/romtools/rofsbuild/rofsbuild.cpp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rofsbuild/rofsbuild.cpp Wed Nov 17 16:47:23 2010 +0800 @@ -34,8 +34,7 @@ #include "cache/cachevalidator.hpp" #include "cache/cacheablelist.hpp" #include "cache/cachemanager.hpp" -#include "logging/loggingexception.hpp" -#include "logging/logparser.hpp" +#include "logparser.h" #include #ifndef WIN32 @@ -48,8 +47,8 @@ #endif static const TInt RofsbuildMajorVersion=2; -static const TInt RofsbuildMinorVersion=16; -static const TInt RofsbuildPatchVersion=3; +static const TInt RofsbuildMinorVersion=17; +static const TInt RofsbuildPatchVersion=0; static TBool SizeSummary=EFalse; static TPrintType SizeWhere=EAlways; @@ -61,6 +60,7 @@ TInt gThreadNum = 0; TInt gCPUNum = 0; TBool gGenSymbols = EFalse; +TBool gGenBsymbols = EFalse; TInt gCodePagingOverride = -1; TInt gDataPagingOverride = -1; TInt gLogLevel = 0; // Information is logged based on logging level. @@ -101,6 +101,7 @@ " -compress compress executable files where possible\n" " -j do the main job with threads\n" " -symbols generate symbol file\n" + " -bsymbols generate binary symbol file\n" " -compressionmethod none|inflate|bytepair to set the compression\n" " none uncompress the image.\n" " inflate compress the image.\n" @@ -172,6 +173,9 @@ }else if (stricmp(argv[i], "-SYMBOLS") == 0) { gGenSymbols = ETrue; } + else if (stricmp(argv[i], "-BSYMBOLS") == 0 ) { + gGenBsymbols = ETrue; + } else if (((argv[i][1] | 0x20) == 's') && (((argv[i][2]| 0x20) == 'l')||((argv[i][2] | 0x20) == 's'))) { SizeSummary = ETrue; @@ -353,6 +357,11 @@ if (paramFileFlag) return; + if(gGenSymbols && gGenBsymbols) + { + Print(EWarning, "Options symbols and bsymbols cannot be used at the same time, the common symbols file will be created this time!\n"); + gGenBsymbols = EFalse; + } if((gDriveImage == EFalse) && (gSmrImage == EFalse) && (filename.empty() || (gUseCoreImage && gImageFilename.length() == 0)) && (loginput.length() == 0)){ @@ -496,11 +505,11 @@ processCommandLine(argc, argv); if(gThreadNum == 0) { if(gCPUNum > 0) { - printf("WARNING: The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum); - gThreadNum = gCPUNum; + printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2); + gThreadNum = gCPUNum * 2; } else { - printf("WARNING: Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS); + printf("Can't automatically get the valid number of concurrent jobs and %d is used.\n", DEFAULT_THREADS); gThreadNum = DEFAULT_THREADS; } } @@ -508,7 +517,7 @@ { try { - LogParser::GetInstance()->ParseSymbol(loginput.c_str()); + LogParser::GetInstance(ERofsImage)->ParseSymbol(loginput.c_str()); } catch(LoggingException le) { diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rofsbuild/rofsbuild.mmp --- a/imgtools/romtools/rofsbuild/rofsbuild.mmp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rofsbuild/rofsbuild.mmp Wed Nov 17 16:47:23 2010 +0800 @@ -23,15 +23,15 @@ // rofsbuild SOURCEPATH ../rofsbuild SOURCE r_obey.cpp r_build.cpp r_rofs.cpp r_driveimage.cpp r_driveutl.cpp -SOURCE rofsbuild.cpp r_coreimage.cpp r_smrimage.cpp symbolgenerator.cpp +SOURCE rofsbuild.cpp r_coreimage.cpp r_smrimage.cpp SOURCE fatcluster.cpp fsnode.cpp fatimagegenerator.cpp -SOURCE symbolprocessunit.cpp +SOURCEPATH ../../imglib/symbolutil +SOURCE symbolprocessunit.cpp bsymutil.cpp loggingexception.cpp logparser.cpp +SOURCE symbolgenerator.cpp SOURCEPATH ../../imglib/host SOURCE h_utl.cpp h_file.cpp h_mem.cpp utf16string.cpp SOURCEPATH ../rofsbuild/src/cache SOURCE cachemanager.cpp cacheexception.cpp cache.cpp cacheablelist.cpp cachevalidator.cpp cachegenerator.cpp cacheentry.cpp -SOURCEPATH ../rofsbuild/src/logging -SOURCE loggingexception.cpp logparser.cpp // executable compression SOURCEPATH ../../imglib/e32uid @@ -46,7 +46,7 @@ OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE ../../imglib/inc ../../imglib/compress +USERINCLUDE ../../imglib/inc ../../imglib/compress ../../imglib/symbolutil USERINCLUDE ../../imglib/patchdataprocessor/include ../../imglib/parameterfileprocessor/include USERINCLUDE ../../imglib/memmap/include USERINCLUDE ../../imglib/uniconv/include diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rombuild/r_mromimage.h --- a/imgtools/romtools/rombuild/r_mromimage.h Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rombuild/r_mromimage.h Wed Nov 17 16:47:23 2010 +0800 @@ -44,9 +44,7 @@ virtual TUint32 DataRunAddress() const = 0 ; virtual TUint32 RomAlign() const = 0 ; -#ifdef __LINUX__ virtual ~MRomImage() { }; -#endif }; #endif //__R_MROMIMAGE_H__ diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rombuild/r_rom.cpp --- a/imgtools/romtools/rombuild/r_rom.cpp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rombuild/r_rom.cpp Wed Nov 17 16:47:23 2010 +0800 @@ -399,7 +399,7 @@ E32Rom::~E32Rom() { if(iSymGen){ - delete iSymGen; + SymbolGenerator::Release(); iSymGen = NULL ; } if(gLowMem) @@ -699,8 +699,6 @@ if (r!=KErrNone) { Print(EError, "LoadContents failed - return code %d\n", r); - if(iSymGen) - iSymGen->WaitThreads(); return r; } iExtensionRomHeader->iRomRootDirectoryList = dummy.iRomRootDirectoryList; @@ -708,8 +706,6 @@ iLoaderHeader->SetUp(iObey); FinaliseExtensionHeader(aKernelRom); DisplayExtensionHeader(); - if(iSymGen) - iSymGen->WaitThreads(); return KErrNone; } @@ -740,8 +736,6 @@ if (r!=KErrNone) { Print(EError, "LoadContents failed - return code %d\n", r); - if(iSymGen) - iSymGen->WaitThreads(); return r; } @@ -749,16 +743,12 @@ if(r!=KErrNone) { Print(EError, "Setup pages information failed - return code %d\n", r); - if(iSymGen) - iSymGen->WaitThreads(); return r; } r = CheckUnpagedMemSize(); // check for unpaged memory overflow if(r!=KErrNone) { - if(iSymGen) - iSymGen->WaitThreads(); return r; } @@ -766,8 +756,6 @@ if(r!=KErrNone) { Print(EError, "CompressPages failed - return code %d\n", r); - if(iSymGen) - iSymGen->WaitThreads(); return r; } @@ -795,8 +783,6 @@ TUint testCheckSum = HMem::CheckSum((TUint *)iHeader, iHeader->iRomSize); Print(ELog, "Rom 32bit words sum to %08x\n", testCheckSum); if (testCheckSum != iObey->iCheckSum){ - if(iSymGen) - iSymGen->WaitThreads(); return Print(EError, "Rom checksum is incorrect: %08x should be %08x\n", testCheckSum, iObey->iCheckSum); } @@ -836,8 +822,6 @@ } } } - if(iSymGen) - iSymGen->WaitThreads(); return KErrNone; } @@ -1325,9 +1309,9 @@ TInt fileCount=0; if(gGenSymbols && !iSymGen) { string filename(iObey->GetFileName()); - filename.erase(filename.length() - 3,3); - filename.append("symbol"); - iSymGen = new SymbolGenerator(filename.c_str(),gThreadNum - 1); + iSymGen = SymbolGenerator::GetInstance(); + iSymGen ->SetImageType(ERomImage); + iSymGen ->SetSymbolFileName(filename); } // @@ -1399,9 +1383,7 @@ mainptr->Extend(offset); iOverhead +=offset; if(iSymGen){ - SymGenContext context ; - memset(&context,0,sizeof(SymGenContext)); - iSymGen->AddEntry(context); + iSymGen->SetFinished(); } return (char*)mainptr->iImagePtr; } @@ -1454,8 +1436,7 @@ return; // first section has overflowed current->FixupRomEntries(size); if(iSymGen) { - SymGenContext context ; - memset(&context,0,sizeof(SymGenContext)); + TPlacedEntry context ; context.iFileName = current->iFileName ; context.iDataAddress = savedAddr ; iSymGen->AddEntry(context); @@ -1470,8 +1451,7 @@ iHeader->iHcrFileAddress = current->iHeaderRange.iImageAddr ; TRACE(TAREA, Print(ELog, "iHeader->iHcrFileAddress = %08x\n", iHeader->iHcrFileAddress)); if(iSymGen) { - SymGenContext context ; - memset(&context,0,sizeof(SymGenContext)); + TPlacedEntry context ; context.iFileName = current->iFileName ; context.iDataAddress = savedAddr ; iSymGen->AddEntry(context); @@ -1535,7 +1515,7 @@ LoadFileToRom(current); TRomImageHeader *header = current->iRomImageHeader; if(iSymGen){ - SymGenContext context ; + TPlacedEntry context ; context.iFileName = current->iFileName ; context.iTotalSize = section1size; context.iCodeAddress = header->iCodeAddress; diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rombuild/rombuild.cpp --- a/imgtools/romtools/rombuild/rombuild.cpp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rombuild/rombuild.cpp Wed Nov 17 16:47:23 2010 +0800 @@ -26,14 +26,15 @@ #include "r_dir.h" #include "r_coreimage.h" +#include "logparser.h" const TInt KRomLoaderHeaderNone=0; const TInt KRomLoaderHeaderEPOC=1; const TInt KRomLoaderHeaderCOFF=2; static const TInt RombuildMajorVersion=2; -static const TInt RombuildMinorVersion=18; -static const TInt RombuildPatchVersion=4; +static const TInt RombuildMinorVersion=19; +static const TInt RombuildPatchVersion=0; static TBool SizeSummary=EFalse; static TPrintType SizeWhere=EAlways; static string compareROMName = ""; @@ -49,11 +50,13 @@ TBool gGenDepGraph = EFalse; string gDepInfoFile = ""; TBool gGenSymbols = EFalse ; +TBool gGenBsymbols = EFalse ; TBool gIsOBYUTF8 = EFalse; +static string loginput = ""; void PrintVersion() { - Print(EAlways,"\nROMBUILD - Rom builder"); - Print(EAlways, " V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion); - Print(EAlways,Copyright); + printf("\nROMBUILD - Rom builder"); + printf(" V%d.%d.%d\n", RombuildMajorVersion, RombuildMinorVersion, RombuildPatchVersion); + printf(Copyright); } char HelpText[] = @@ -82,7 +85,8 @@ " -lowmem use memory-mapped file for image build to reduce physical memory consumption\n" " -coreimage= to pass the core image as input for extension ROM image generation\n" " -k to enable keepgoing when duplicate files exist in oby\n" - " -logfile= specify log file\n"; + " -logfile= specify log file\n" + " -loginput= specify as input a log file and produce as output symbol file.\n"; char ReallyHelpText[] = @@ -349,6 +353,9 @@ else if (strnicmp(arg, "logfile=",8) ==0) { romlogfile = arg + 8; } + else if (strnicmp(arg, "loginput=",9) ==0) { + loginput = arg + 9; + } else #ifdef WIN32 cout << "Unrecognised option " << argv[i] << "\n"; @@ -366,7 +373,7 @@ } if (paramFileFlag) return; - if (filename.empty()) { + if (filename.empty() && loginput.empty()) { PrintVersion(); cout << HelpText; if (reallyHelp) { @@ -450,29 +457,42 @@ ParseCapabilitiesArg(gPlatSecAllCaps, "all"); processCommandLine(argc, argv); - if(filename.empty()) + if(filename.empty() && loginput.empty()) return KErrGeneral; - if (romlogfile[romlogfile.size()-1] == '\\' || romlogfile[romlogfile.size()-1] == '/') - romlogfile += "ROMBUILD.LOG"; - H.SetLogFile(romlogfile.c_str()); if(gThreadNum == 0) { if(gCPUNum > 0 && gCPUNum <= MAXIMUM_THREADS) { - Print(EAlways, "The number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum); - gThreadNum = gCPUNum; + printf("The double number of processors (%d) is used as the number of concurrent jobs.\n", gCPUNum * 2); + gThreadNum = gCPUNum * 2; } else if(g_pCharCPUNum) { - Print(EWarning, "The NUMBER_OF_PROCESSORS is invalid, and the default value %d will be used.\n", DEFAULT_THREADS); + printf("The NUMBER_OF_PROCESSORS is invalid, and the default value %d will be used.\n", DEFAULT_THREADS); gThreadNum = DEFAULT_THREADS; } else { - Print(EWarning, "The NUMBER_OF_PROCESSORS is not available, and the default value %d will be used.\n", DEFAULT_THREADS); + printf("The NUMBER_OF_PROCESSORS is not available, and the default value %d will be used.\n", DEFAULT_THREADS); gThreadNum = DEFAULT_THREADS; } } PrintVersion(); + if(loginput.length() >= 1) + { + try + { + LogParser::GetInstance(ERomImage)->ParseSymbol(loginput.c_str()); + } + catch(LoggingException le) + { + printf("ERROR: %s\r\n", le.GetErrorMessage()); + return 1; + } + return 0; + } + if (romlogfile[romlogfile.size()-1] == '\\' || romlogfile[romlogfile.size()-1] == '/') + romlogfile += "ROMBUILD.LOG"; + H.SetLogFile(romlogfile.c_str()); ObeyFileReader *reader=new ObeyFileReader(filename.c_str()); if (!reader->Open()) { delete reader; diff -r 1dfff72f0961 -r c3fbb20e86f0 imgtools/romtools/rombuild/rombuild.mmp --- a/imgtools/romtools/rombuild/rombuild.mmp Wed Nov 17 14:41:23 2010 +0800 +++ b/imgtools/romtools/rombuild/rombuild.mmp Wed Nov 17 16:47:23 2010 +0800 @@ -24,7 +24,10 @@ source r_dir.cpp r_header.cpp r_obey.cpp r_srec.cpp source r_rom.cpp rombuild.cpp r_build.cpp r_collapse.cpp source r_global.cpp r_areaset.cpp -source r_coreimage.cpp r_coreimagereader.cpp symbolgenerator.cpp +source r_coreimage.cpp r_coreimagereader.cpp +sourcepath ../../imglib/symbolutil +source symbolgenerator.cpp symbolprocessunit.cpp bsymutil.cpp +source loggingexception.cpp logparser.cpp sourcepath ../../imglib/e32uid source e32uid.cpp sourcepath ../../imglib/host @@ -38,7 +41,7 @@ source byte_pair.cpp source pagedcompress.cpp -userinclude ../../imglib/compress ../../imglib/inc +userinclude ../../imglib/compress ../../imglib/inc ../../imglib/symbolutil userinclude ../../imglib/patchdataprocessor/include ../../imglib/parameterfileprocessor/include userinclude ../../imglib/uniconv/include userinclude ../../imglib/memmap/include @@ -46,7 +49,7 @@ OS_LAYER_SYSTEMINCLUDE_SYMBIAN -staticlibrary patchdataprocessor parameterfileprocessor memmap boost_thread-1.39 uniconv +staticlibrary patchdataprocessor parameterfileprocessor memmap boost_thread-1.39 boost_regex-1.39 uniconv #ifdef TOOLS2_LINUX OPTION GCC -O2 -Wno-uninitialized -pthread