author | lorewang |
Wed, 01 Dec 2010 16:05:36 +0800 | |
changeset 715 | e0739b8406dd |
parent 714 | e5a58c351011 |
permissions | -rw-r--r-- |
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 |
#include <boost/regex.hpp> |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
18 |
#include "symbolprocessunit.h" |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
19 |
#include "e32image.h" |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
20 |
#include "symbolgenerator.h" |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
21 |
#include "h_utl.h" |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
22 |
|
712 | 23 |
#ifdef _MSC_VER |
24 |
#define snprintf _snprintf |
|
25 |
#endif |
|
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
26 |
#define MAX_LINE 65535 |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
27 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
28 |
#if defined(__LINUX__) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
29 |
#define PATH_SEPARATOR '/' |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
30 |
#else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
31 |
#define PATH_SEPARATOR '\\' |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
32 |
#endif |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
33 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
34 |
void SymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
35 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
36 |
if(aEntry.iFileName == "") |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
37 |
return; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
38 |
else if(aEntry.iExecutable) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
39 |
ProcessExecutableFile(aEntry.iFileName); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
40 |
else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
41 |
ProcessDataFile(aEntry.iFileName); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
42 |
} |
714
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
43 |
void SymbolProcessUnit::FlushStdOut(stringlist& aList) |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
44 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
45 |
for(int i = 0; i < (int) iStdoutLog.size(); i++) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
46 |
{ |
714
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
47 |
aList.push_back(iStdoutLog[i]); |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
48 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
49 |
} |
714
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
50 |
// CommenRomSymbolProcessUnit start |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
51 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
52 |
void CommenRomSymbolProcessUnit::FlushSymbolContent(ostream &aOut) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
53 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
54 |
for(int i = 0; i < (int) iSymbolContentLog.size(); i++) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
55 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
56 |
aOut << iSymbolContentLog[i]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
57 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
58 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
59 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
60 |
void CommenRomSymbolProcessUnit::ResetContentLog() |
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 |
iStdoutLog.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
63 |
iSymbolContentLog.clear(); |
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 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
66 |
void CommenRomSymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
67 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
68 |
iPlacedEntry = aEntry; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
69 |
SymbolProcessUnit::ProcessEntry(aEntry); |
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 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
72 |
void CommenRomSymbolProcessUnit::ProcessExecutableFile(const string& aFile) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
73 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
74 |
ResetContentLog(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
75 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
76 |
string outString; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
77 |
outString = "\nFrom "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
78 |
outString += aFile + "\n\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
79 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
80 |
string mapFile2 = aFile+".map"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
81 |
size_t dot = aFile.rfind('.'); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
82 |
string mapFile = aFile.substr(0,dot)+".map"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
83 |
ifstream fMap; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
84 |
fMap.open(mapFile2.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
85 |
if(!fMap.is_open()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
86 |
fMap.open(mapFile.c_str()); |
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 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
89 |
if(!fMap.is_open()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
90 |
sprintf(str, "\nWarning: Can't open \"%s\" or \"%s\"\n",mapFile2.c_str(),mapFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
91 |
iStdoutLog.push_back(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
92 |
memset(str,0,sizeof(str)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
93 |
sprintf(str, "%08x %04x ", (unsigned int)iPlacedEntry.iCodeAddress, (unsigned int)iPlacedEntry.iTotalSize); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
94 |
outString = str; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
95 |
outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
96 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
97 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
98 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
99 |
if(!fMap.good()) fMap.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
100 |
char buffer[100]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
101 |
fMap.getline(buffer, 100); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
102 |
boost::regex regARMV5("ARM Linker", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
103 |
boost::regex regGCCEoARMV4("Archive member included", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
104 |
boost::cmatch what; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
105 |
if(regex_search(buffer, what, regARMV5)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
106 |
ProcessArmv5File(aFile, fMap); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
107 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
108 |
else if(regex_search(buffer, what, regGCCEoARMV4)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
109 |
ProcessGcceOrArm4File(aFile, fMap); |
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 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
112 |
fMap.seekg(0, ios_base::beg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
113 |
ProcessX86File(aFile, fMap); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
114 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
115 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
116 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
117 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
118 |
void CommenRomSymbolProcessUnit::ProcessDataFile(const string& aFile) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
119 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
120 |
ResetContentLog(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
121 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
122 |
memset(str,0,sizeof(str)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
123 |
string basename = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
124 |
sprintf(str, "\nFrom %s\n\n%08x 0000 %s\n", aFile.c_str(), (unsigned int) iPlacedEntry.iDataAddress, basename.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
125 |
iSymbolContentLog.push_back(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
126 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
127 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
128 |
struct ArmSymbolInfo { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
129 |
string name ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
130 |
TUint size ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
131 |
string section ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
132 |
}; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
133 |
typedef multimap<TUint32,ArmSymbolInfo> ArmSymMap ; |
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 |
#define SKIP_WS(p) while((*p) == ' ' || (*p) == '\t') (p)++ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
136 |
#define FIND_WS(p) while((*p) != ' ' && (*p) != '\t' && (*p) != 0) (p)++ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
137 |
static void split(char* str, vector<char*>& result) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
138 |
result.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
139 |
while(*str) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
140 |
SKIP_WS(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
141 |
char* saved = str ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
142 |
FIND_WS(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
143 |
bool end = (0 == *str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
144 |
*str = 0 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
145 |
if(saved != str) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
146 |
result.push_back(saved); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
147 |
if(!end) str ++ ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
148 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
149 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
150 |
static void make_lower(char* str){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
151 |
while(*str){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
152 |
if(*str >= 'A' && *str >= 'Z') { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
153 |
*str += ('a' - 'A'); |
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 |
str++; |
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 |
} |
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 |
void CommenRomSymbolProcessUnit::ProcessArmv5File(const string& aFile, ifstream& aMap) |
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 |
string symName ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
162 |
ArmSymMap symbols ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
163 |
vector<char*> words ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
164 |
ArmSymbolInfo info; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
165 |
char* lineStart ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
166 |
char buffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
167 |
while(aMap.good() && (!aMap.eof())){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
168 |
*buffer = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
169 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
170 |
lineStart = buffer ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
171 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
172 |
if(strstr(lineStart,"Global Symbols")) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
173 |
break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
174 |
char* armstamp = strstr(lineStart,"ARM Code"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
175 |
if(0 == armstamp) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
176 |
armstamp = strstr(lineStart,"Thumb Code") ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
177 |
if(0 == armstamp) continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
178 |
*(armstamp - 1) = 0 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
179 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
180 |
char* hexStr = lineStart ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
181 |
char* nameEnd; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
182 |
while(1) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
183 |
hexStr = strstr(hexStr,"0x"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
184 |
if(0 == hexStr) break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
185 |
nameEnd = hexStr - 1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
186 |
if(*nameEnd == ' ' || *nameEnd == '\t') break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
187 |
hexStr += 2 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
188 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
189 |
if(0 == hexStr) continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
190 |
while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t')) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
191 |
nameEnd -- ; |
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 |
nameEnd[1] = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
194 |
info.name = lineStart; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
195 |
char* temp ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
196 |
TUint32 addr = strtoul(hexStr + 2,&temp,16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
197 |
char* decStr ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
198 |
if(*armstamp == 'A') |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
199 |
decStr = armstamp + 9 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
200 |
else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
201 |
decStr = armstamp + 11 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
202 |
SKIP_WS(decStr); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
203 |
info.size = strtoul(decStr,&temp,10); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
204 |
SKIP_WS(temp); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
205 |
info.section = temp; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
206 |
if(info.section.find("(StubCode)") != string::npos ) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
207 |
info.size = 8 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
208 |
if(addr > 0){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
209 |
symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
210 |
} |
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 |
size_t lenOfFileName = iPlacedEntry.iFileName.length(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
213 |
while(aMap.good() && (!aMap.eof())){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
214 |
*buffer = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
215 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
216 |
lineStart = buffer ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
217 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
218 |
char* hexStr = lineStart ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
219 |
char* nameEnd; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
220 |
while(1) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
221 |
hexStr = strstr(hexStr,"0x"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
222 |
if(0 == hexStr) break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
223 |
nameEnd = hexStr - 1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
224 |
if(*nameEnd == ' ' || *nameEnd == '\t') |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
225 |
break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
226 |
hexStr += 2 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
227 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
228 |
if(0 == hexStr) continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
229 |
while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t')){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
230 |
nameEnd -- ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
231 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
232 |
nameEnd[1] = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
233 |
info.name = lineStart; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
234 |
char *temp ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
235 |
TUint32 addr = strtoul(hexStr + 2,&temp,16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
236 |
while(*temp < '0' || *temp > '9' )//[^\d]* |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
237 |
temp++ ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
238 |
char* decStr = temp ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
239 |
info.size = strtoul(decStr,&temp,10); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
240 |
SKIP_WS(temp); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
241 |
info.section = temp; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
242 |
if(info.section.find("(StubCode)") != string::npos ) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
243 |
info.size = 8 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
244 |
if(addr > 0){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
245 |
symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
246 |
} |
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 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
249 |
TUint32 textSectAddr = 0x00008000; // .text gets linked at 0x00008000 |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
250 |
TUint32 dataSectAddr = 0x00400000 ; // .data gets linked at 0x00400000 |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
251 |
vector<pair<int,char*> > lines ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
252 |
size_t allocBytes; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
253 |
for( ArmSymMap::iterator it = symbols.begin(); it != symbols.end() ; it++){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
254 |
TUint32 thisAddr = it->first ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
255 |
TUint32 romAddr ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
256 |
ArmSymbolInfo& info = it->second; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
257 |
if (thisAddr >= textSectAddr && thisAddr <= (textSectAddr + iPlacedEntry.iTextSize)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
258 |
romAddr = thisAddr - textSectAddr + iPlacedEntry.iCodeAddress ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
259 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
260 |
else if ( iPlacedEntry.iDataAddress && |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
261 |
( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr + iPlacedEntry.iTextSize))) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
262 |
romAddr = thisAddr-dataSectAddr + iPlacedEntry.iDataBssLinearBase; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
263 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
264 |
else if ( iPlacedEntry.iDataBssLinearBase && |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
265 |
( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr+ iPlacedEntry.iTotalDataSize))) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
266 |
romAddr = thisAddr - dataSectAddr + iPlacedEntry.iDataBssLinearBase; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
267 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
268 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
269 |
allocBytes = info.name.length() + 60; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
270 |
char* msg = new char[allocBytes] ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
271 |
snprintf(msg,allocBytes,"\r\nWarning: Symbol %s @ 0x%08x not in text or data segments\r\n", \ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
272 |
info.name.c_str() ,(unsigned int)thisAddr) ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
273 |
iStdoutLog.push_back(msg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
274 |
allocBytes = lenOfFileName + 80; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
275 |
msg = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
276 |
snprintf(msg,allocBytes,"Warning: The map file for binary %s is out-of-sync with the binary itself\r\n\r\n",iPlacedEntry.iFileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
277 |
iStdoutLog.push_back(msg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
278 |
continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
279 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
280 |
allocBytes = info.section.length() + info.name.length() + 140; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
281 |
char* outputLine = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
282 |
int len = snprintf(outputLine,allocBytes,"%08x %04x %-40s %s\r\n",(unsigned int)romAddr,info.size, |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
283 |
info.name.c_str(),info.section.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
284 |
if((size_t)len > allocBytes) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
285 |
allocBytes = len + 4 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
286 |
delete []outputLine; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
287 |
outputLine = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
288 |
len = snprintf(outputLine,allocBytes,"%08x %04x %-40s %s\r\n",(unsigned int)romAddr,info.size, |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
289 |
info.name.c_str(),info.section.c_str()); |
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 |
lines.push_back(pair<int,char*>(len,outputLine)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
292 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
293 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
294 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
295 |
for (vector<pair<int,char*> >::iterator i = lines.begin() ; i < lines.end(); i ++ ) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
296 |
char* line = i->second; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
297 |
iSymbolContentLog.push_back(line); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
298 |
delete[] line; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
299 |
} |
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 |
template<typename M, typename K,typename V> |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
303 |
static void put_to_map(M& m,const K& k, const V& v) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
304 |
typedef typename M::iterator iterator; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
305 |
iterator it = m.find(k); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
306 |
if(m.end() == it){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
307 |
m.insert(pair<K,V>(k,v)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
308 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
309 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
310 |
it->second = v ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
311 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
312 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
313 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
314 |
void CommenRomSymbolProcessUnit::ProcessGcceOrArm4File(const string& aFile, ifstream& aMap) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
315 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
316 |
char* lineStart; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
317 |
vector<char*> words ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
318 |
char buffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
319 |
while(aMap.good() && (!aMap.eof())){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
320 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
321 |
lineStart = buffer ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
322 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
323 |
if( 0 == strncmp(lineStart,".text",5)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
324 |
lineStart += 5; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
325 |
break ; |
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 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
328 |
split(lineStart,words); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
329 |
TUint32 codeAddr , codeSize; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
330 |
size_t allocBytes ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
331 |
if(words.size() != 2 || |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
332 |
KErrNone != Val(codeAddr,words.at(0)) || |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
333 |
KErrNone != Val(codeSize,words.at(1))) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
334 |
allocBytes = iPlacedEntry.iFileName.length() + 60; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
335 |
char* msg = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
336 |
snprintf(msg,allocBytes,"\nError: Can't get .text section info for \"%s\"\r\n",iPlacedEntry.iFileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
337 |
iStdoutLog.push_back(msg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
338 |
return; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
339 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
340 |
map<TUint32,string> symbols ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
341 |
TUint32 stubHex = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
342 |
//Slurp symbols 'til the end of the text section |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
343 |
while(aMap.good() && (!aMap.eof())){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
344 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
345 |
lineStart = buffer ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
346 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
347 |
if(0 == *lineStart) break ; //blank line marks the end of the text section |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
348 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
349 |
// .text <addr> <len> <library(member)> |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
350 |
// .text$something |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
351 |
// <addr> <len> <library(member)> |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
352 |
// <addr> <len> LONG 0x0 |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
353 |
// (/^\s(\.text)?\s+(0x\w+)\s+(0x\w+)\s+(.*)$/io) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
354 |
if(strncmp(lineStart,".text",5) == 0){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
355 |
lineStart += 5 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
356 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
357 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
358 |
char* hex1 = NULL ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
359 |
char* hex2 = NULL ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
360 |
char* strAfterhex1 = NULL ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
361 |
TUint32 addr,size ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
362 |
if(strncmp(lineStart,"0x",2) == 0){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
363 |
hex1 = lineStart + 2; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
364 |
char* temp ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
365 |
addr = strtoul(hex1,&temp,16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
366 |
SKIP_WS(temp); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
367 |
strAfterhex1 = temp ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
368 |
if(strncmp(temp,"0x",2) == 0){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
369 |
hex2 = temp + 2 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
370 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
371 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
372 |
if(NULL != hex2){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
373 |
char* libraryfile ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
374 |
size = strtoul(hex2,&libraryfile,16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
375 |
SKIP_WS(libraryfile); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
376 |
TUint32 key = addr + size ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
377 |
put_to_map(symbols,key,string(""));//impossible symbol as end marker |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
378 |
make_lower(libraryfile); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
379 |
// EUSER.LIB(ds01423.o) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
380 |
// EUSER.LIB(C:/TEMP/d1000s_01423.o) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
381 |
size_t len = strlen(libraryfile); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
382 |
char* p1 = strstr(libraryfile,".lib("); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
383 |
if(NULL == p1) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
384 |
continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
385 |
p1 += 5; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
386 |
if(strcmp(libraryfile + len - 3,".o)")!= 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
387 |
continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
388 |
len -= 3 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
389 |
libraryfile[len] = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
390 |
if(EFalse == IsValidNumber(libraryfile + len - 5)) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
391 |
continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
392 |
len -= 7 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
393 |
if('_' == libraryfile[len]) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
394 |
len -- ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
395 |
if('s' != libraryfile[len]) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
396 |
continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
397 |
char* p2 = libraryfile + len - 1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
398 |
while(p2 > p1 ) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
399 |
if(*p2 < '0' || *p2 > '9') |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
400 |
break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
401 |
p2 -- ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
402 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
403 |
if(*p2 != 'd') |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
404 |
continue ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
405 |
stubHex = addr ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
406 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
407 |
else if(NULL != hex1 && NULL != strAfterhex1){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
408 |
//# <addr> <symbol name possibly including spaces> |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
409 |
//(/^\s+(\w+)\s\s+([a-zA-Z_].+)/o) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
410 |
char* symName = strAfterhex1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
411 |
if((*symName >= 'A' && *symName <= 'Z') || |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
412 |
(*symName >= 'a' && *symName <= 'z') || *symName == '_') { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
413 |
string symbol(symName); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
414 |
if(addr == stubHex) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
415 |
symbol.insert(0,"stub "); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
416 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
417 |
put_to_map(symbols,addr,symbol); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
418 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
419 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
420 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
421 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
422 |
map<TUint32,string>::iterator it = symbols.begin(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
423 |
TUint32 lastAddr = it->first; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
424 |
string lastSymName = it->second; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
425 |
vector<pair<int,char*> >lines ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
426 |
it ++ ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
427 |
while(it != symbols.end()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
428 |
TUint32 addr = it->first ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
429 |
unsigned int fixedupAddr = lastAddr - codeAddr + iPlacedEntry.iCodeAddress; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
430 |
TUint size = addr - lastAddr ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
431 |
if(!lastSymName.empty()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
432 |
allocBytes = lastSymName.length() + 40; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
433 |
char* outputLine = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
434 |
int n = snprintf(outputLine,allocBytes,"%08x %04x %s\r\n", fixedupAddr,size,lastSymName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
435 |
lines.push_back(pair<int,char*>(n,outputLine)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
436 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
437 |
lastAddr = addr ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
438 |
lastSymName = it->second; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
439 |
it ++ ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
440 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
441 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
442 |
vector<pair<int,char*> >::iterator i; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
443 |
for ( i = lines.begin() ; i < lines.end(); i ++ ) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
444 |
char* line = i->second ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
445 |
iSymbolContentLog.push_back(line); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
446 |
delete []line ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
447 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
448 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
449 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
450 |
void CommenRomSymbolProcessUnit::ProcessX86File(const string& aFile, ifstream& aMap) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
451 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
452 |
char buffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
453 |
char* lineStart; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
454 |
while(aMap.good() && (!aMap.eof())){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
455 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
456 |
lineStart = buffer ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
457 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
458 |
if( 0 == strncmp(lineStart,"Address",7)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
459 |
break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
460 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
461 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
462 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
463 |
string lastName ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
464 |
TUint32 lastAddr = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
465 |
size_t allocBytes ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
466 |
vector<pair<int, char*> >lines ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
467 |
while(aMap.good() && (!aMap.eof())){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
468 |
aMap.getline(buffer,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
469 |
lineStart = buffer ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
470 |
SKIP_WS(lineStart); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
471 |
if(0 != strncmp(lineStart,"0001:",5)) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
472 |
break ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
473 |
char* end ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
474 |
TUint32 addr = strtoul(lineStart + 5,&end,16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
475 |
char* name = end + 1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
476 |
SKIP_WS(name); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
477 |
end = name + 1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
478 |
FIND_WS(end); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
479 |
*end = 0 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
480 |
if(!lastName.empty()){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
481 |
unsigned int size = addr - lastAddr ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
482 |
unsigned int romAddr = lastAddr + iPlacedEntry.iCodeAddress; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
483 |
allocBytes = lastName.length() + 40; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
484 |
char* outputLine = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
485 |
int n = snprintf(outputLine,allocBytes,"%08x %04x %s\r\n",romAddr,size,lastName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
486 |
lines.push_back(pair<int, char*>(n,outputLine)); |
714
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
487 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
488 |
lastName = name; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
489 |
lastAddr = addr; |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
490 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
491 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
492 |
vector<pair<int,char*> >::iterator it; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
493 |
for ( it = lines.begin() ; it < lines.end(); it ++ ) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
494 |
char* line = it->second ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
495 |
iSymbolContentLog.push_back(line); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
496 |
delete []line ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
497 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
498 |
if(!lastName.empty()){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
499 |
allocBytes = lastName.length() + 40 ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
500 |
char* outputLine = new char[allocBytes]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
501 |
unsigned int romAddr = lastAddr + iPlacedEntry.iCodeAddress; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
502 |
snprintf(outputLine,allocBytes,"%08x 0000 %s\r\n",romAddr,lastName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
503 |
iSymbolContentLog.push_back(outputLine); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
504 |
delete []outputLine ; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
505 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
506 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
507 |
// CommenRomSymbolProcessUnit end |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
508 |
// CommenRofsSymbolProcessUnit start |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
509 |
void CommenRofsSymbolProcessUnit::ProcessExecutableFile(const string& aFile) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
510 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
511 |
ResetContentLog(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
512 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
513 |
string outString; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
514 |
outString = "\nFrom "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
515 |
outString += aFile + "\n\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
516 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
517 |
string mapFile2 = aFile+".map"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
518 |
size_t dot = aFile.rfind('.'); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
519 |
string mapFile = aFile.substr(0,dot)+".map"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
520 |
ifstream fMap; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
521 |
fMap.open(mapFile2.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
522 |
if(!fMap.is_open()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
523 |
fMap.open(mapFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
524 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
525 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
526 |
if(!fMap.is_open()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
527 |
sprintf(str, "%s\nWarning: Can't open \"%s\" or \"%s\"\n",aFile.c_str(),mapFile2.c_str(),mapFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
528 |
iStdoutLog.push_back(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
529 |
int binSize = GetSizeFromBinFile(aFile); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
530 |
memset(str,0,sizeof(str)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
531 |
sprintf(str,"%04x", binSize); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
532 |
outString = "00000000 "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
533 |
outString += str; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
534 |
outString += " "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
535 |
outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
536 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
537 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
538 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
539 |
if(!fMap.good()) fMap.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
540 |
boost::regex regARMV5("ARMV5", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
541 |
boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
542 |
boost::cmatch what; |
712 | 543 |
if(regex_search(aFile.c_str(), what, regARMV5)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
544 |
ProcessArmv5File(aFile, fMap); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
545 |
} |
712 | 546 |
else if(regex_search(aFile.c_str(), what, regGCCEoARMV4)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
547 |
ProcessGcceOrArm4File(aFile, fMap); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
548 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
549 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
550 |
sprintf(str, "\nWarning: cannot determine linker type used to create %s\n",aFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
551 |
iStdoutLog.push_back(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
552 |
outString = "00000000 0000 "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
553 |
outString += aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
554 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
555 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
556 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
557 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
558 |
void CommenRofsSymbolProcessUnit::ProcessDataFile(const string& aFile) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
559 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
560 |
ResetContentLog(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
561 |
string line = "\nFrom "+aFile+"\n\n00000000 0000 "+aFile.substr(aFile.rfind(PATH_SEPARATOR)+1)+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
562 |
iSymbolContentLog.push_back(line); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
563 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
564 |
void CommenRofsSymbolProcessUnit::FlushSymbolContent(ostream &aOut) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
565 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
566 |
for(int i = 0; i < (int) iSymbolContentLog.size(); i++) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
567 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
568 |
aOut << iSymbolContentLog[i]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
569 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
570 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
571 |
void CommenRofsSymbolProcessUnit::ResetContentLog() |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
572 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
573 |
iStdoutLog.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
574 |
iSymbolContentLog.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
575 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
576 |
void CommenRofsSymbolProcessUnit::ProcessArmv5File( const string& fileName, ifstream& aMap ){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
577 |
aMap.seekg (0, ios::beg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
578 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
579 |
char outbuffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
580 |
string outString; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
581 |
aMap.getline(str,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
582 |
boost::cmatch what; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
583 |
boost::regex reg("^ARM Linker"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
584 |
if(!regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
585 |
sprintf(outbuffer, "\nWarning: expecting %s to be generated by ARM linker\n", fileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
586 |
iStdoutLog.push_back(outbuffer); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
587 |
outString = "00000000 0000 "+fileName.substr(fileName.rfind(PATH_SEPARATOR)+1)+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
588 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
589 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
590 |
reg.assign("Global Symbols"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
591 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
592 |
if(regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
593 |
break; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
594 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
595 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
596 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
597 |
reg.assign("^\\s*(.+)\\s*0x(\\S+)\\s+[^\\d]*(\\d+)\\s+(.*)$"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
598 |
string sSym,sTmp,sSection; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
599 |
unsigned int addr,size,baseOffset = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
600 |
map<unsigned int,string> syms; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
601 |
char symString[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
602 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
603 |
if(regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
604 |
sSym.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
605 |
sTmp.assign(what[2].first,what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
606 |
addr = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
607 |
sTmp.assign(what[3].first,what[3].second-what[3].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
608 |
size = strtol(sTmp.c_str(), NULL, 10); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
609 |
sSection.assign(what[4].first,what[4].second-what[4].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
610 |
if(sSection.find("(StubCode)") != string::npos) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
611 |
size = 8; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
612 |
if(addr > 0) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
613 |
memset(symString,0,sizeof(symString)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
614 |
sprintf(symString,"%04x ",size); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
615 |
outString = symString; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
616 |
outString += sSym+" "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
617 |
outString += sSection; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
618 |
if(baseOffset == 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
619 |
baseOffset = addr; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
620 |
unsigned int k = addr - baseOffset; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
621 |
if( (syms.find(k) == syms.end()) || size != 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
622 |
syms[k] = outString; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
623 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
624 |
// end of addr>0 |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
625 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
626 |
// end of regex_search |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
627 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
628 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
629 |
map<unsigned int,string>::iterator it; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
630 |
for(it = syms.begin(); it != syms.end(); it++) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
631 |
memset(str,0,sizeof(str)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
632 |
sprintf(str,"%08x",it->first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
633 |
outString = str; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
634 |
outString += " "; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
635 |
outString += it->second+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
636 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
637 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
638 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
639 |
void CommenRofsSymbolProcessUnit::ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
640 |
aMap.seekg (0, ios_base::beg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
641 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
642 |
char outbuffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
643 |
aMap.getline(str,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
644 |
boost::cmatch what; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
645 |
boost::regex reg("^\\.text\\s+"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
646 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
647 |
if(regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
648 |
break; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
649 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
650 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
651 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
652 |
reg.assign("^\\.text\\s+(\\w+)\\s+\\w+"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
653 |
if(!regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
654 |
sprintf(outbuffer, "ERROR: Can't get .text section info for \"%s\"\n",fileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
655 |
iStdoutLog.push_back(outbuffer); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
656 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
657 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
658 |
string sTmp, sLibFile; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
659 |
sTmp.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
660 |
unsigned int imgText = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
661 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
662 |
reg.assign("^LONG 0x.*", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
663 |
boost::cmatch what1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
664 |
boost::regex reg1("^\\s(\\.text)?\\s+(0x\\w+)\\s+(0x\\w+)\\s+(.*)$", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
665 |
boost::regex reg2("^\\s+(\\w+)\\s\\s+([a-zA-Z_].+)", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
666 |
boost::regex reg3(".*lib\\(.*d\\d*s_?\\d{5}.o\\)$", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
667 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
668 |
map<unsigned int,string> syms; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
669 |
unsigned int addr, len, stubhex; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
670 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
671 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
672 |
if(strlen(str) == 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
673 |
break; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
674 |
else if(regex_search(str, what, reg1)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
675 |
sLibFile.assign(what[4].first,what[4].second-what[4].first); |
712 | 676 |
if(!regex_search(sLibFile.c_str(), what1, reg)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
677 |
sTmp.assign(what[2].first,what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
678 |
addr = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
679 |
sTmp.assign(what[3].first,what[3].second-what[3].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
680 |
len = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
681 |
syms[addr+len] = ""; |
712 | 682 |
if(regex_search(sLibFile.c_str(), what, reg3)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
683 |
stubhex = addr; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
684 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
685 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
686 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
687 |
else if(regex_search(str, what, reg2)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
688 |
sTmp.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
689 |
addr = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
690 |
sTmp.assign(what[2].first,what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
691 |
syms[addr] = (addr == stubhex)? ("stub "+sTmp) : sTmp; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
692 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
693 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
694 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
695 |
map<unsigned int,string>::iterator it = syms.begin(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
696 |
map<unsigned int,string>::iterator itp = it++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
697 |
string outString; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
698 |
for(; it != syms.end(); itp = it++) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
699 |
if(itp->second != "") { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
700 |
memset(str,0,sizeof(str)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
701 |
sprintf(str,"%08x %04x ",(itp->first-imgText), (it->first-itp->first)); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
702 |
outString = str; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
703 |
outString += it->second+"\n"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
704 |
iSymbolContentLog.push_back(outString); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
705 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
706 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
707 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
708 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
709 |
// CommenRofsSymbolProcessUnit end |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
710 |
int SymbolProcessUnit::GetSizeFromBinFile( const string& fileName ){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
711 |
TInt ret = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
712 |
//char outbuffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
713 |
ifstream aIf(fileName.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
|
714 |
if( !aIf.is_open() ) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
715 |
printf("Warning: Cannot open file %s\n", fileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
716 |
//iStdoutLog.push_back(outbuffer); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
717 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
718 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
719 |
E32ImageFile e32Image; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
720 |
TUint32 aSz; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
721 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
722 |
aIf.seekg(0,ios_base::end); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
723 |
aSz = aIf.tellg(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
724 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
725 |
e32Image.Adjust(aSz); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
726 |
e32Image.iFileSize = aSz; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
727 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
728 |
aIf.seekg(0,ios_base::beg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
729 |
aIf >> e32Image; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
730 |
ret = e32Image.iOrigHdr->iCodeSize; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
731 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
732 |
return ret; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
733 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
734 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
735 |
// for BSym |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
736 |
void BsymRofsSymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
737 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
738 |
SymbolProcessUnit::ProcessEntry(aEntry); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
739 |
if(aEntry.iFileName == "") |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
740 |
return; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
741 |
else if(aEntry.iExecutable) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
742 |
ProcessExecutableFile(aEntry.iFileName); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
743 |
else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
744 |
ProcessDataFile(aEntry.iFileName); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
745 |
iMapFileInfo.iDbgUnitPCEntry.iPCName = aEntry.iFileName; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
746 |
iMapFileInfo.iDbgUnitPCEntry.iDevName = aEntry.iDevFileName; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
747 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
748 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
749 |
void BsymRofsSymbolProcessUnit::ProcessExecutableFile(const string& aFile) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
750 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
751 |
ResetContentLog(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
752 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
753 |
string mapFile2 = aFile+".map"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
754 |
size_t dot = aFile.rfind('.'); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
755 |
string mapFile = aFile.substr(0,dot)+".map"; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
756 |
ifstream fMap; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
757 |
fMap.open(mapFile2.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
758 |
if(!fMap.is_open()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
759 |
fMap.open(mapFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
760 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
761 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
762 |
if(!fMap.is_open()) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
763 |
sprintf(str, "%s\nWarning: Can't open \"%s\" or \"%s\"\n",aFile.c_str(),mapFile2.c_str(),mapFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
764 |
iStdoutLog.push_back(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
765 |
int binSize = GetSizeFromBinFile(aFile); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
766 |
TSymbolPCEntry tmpEntry; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
767 |
tmpEntry.iSymbolEntry.iAddress = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
768 |
tmpEntry.iSymbolEntry.iLength = binSize; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
769 |
tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
770 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
771 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
772 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
773 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
774 |
if(!fMap.good()) fMap.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
775 |
boost::regex regARMV5("ARMV5", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
776 |
boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
777 |
boost::cmatch what; |
712 | 778 |
if(regex_search(aFile.c_str(), what, regARMV5)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
779 |
ProcessArmv5File(aFile, fMap); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
780 |
} |
712 | 781 |
else if(regex_search(aFile.c_str(), what, regGCCEoARMV4)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
782 |
ProcessGcceOrArm4File(aFile, fMap); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
783 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
784 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
785 |
sprintf(str, "\nWarning: cannot determine linker type used to create %s\n",aFile.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
786 |
iStdoutLog.push_back(str); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
787 |
TSymbolPCEntry tmpEntry; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
788 |
tmpEntry.iSymbolEntry.iAddress = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
789 |
tmpEntry.iSymbolEntry.iLength = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
790 |
tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
791 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
792 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
793 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
794 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
795 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
796 |
void BsymRofsSymbolProcessUnit::ProcessDataFile(const string& aFile) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
797 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
798 |
ResetContentLog(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
799 |
TSymbolPCEntry tmpEntry; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
800 |
tmpEntry.iSymbolEntry.iAddress = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
801 |
tmpEntry.iSymbolEntry.iLength = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
802 |
tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
803 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
804 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
805 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
806 |
void BsymRofsSymbolProcessUnit::FlushSymbolContent(ostream &aOut) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
807 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
808 |
iSymbolGeneratorPtr->AppendMapFileInfo(iMapFileInfo); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
809 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
810 |
void BsymRofsSymbolProcessUnit::ResetContentLog() |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
811 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
812 |
iStdoutLog.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
813 |
iMapFileInfo.iDbgUnitPCEntry.iPCName = ""; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
814 |
iMapFileInfo.iDbgUnitPCEntry.iDevName = ""; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
815 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.Reset(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
816 |
iMapFileInfo.iSymbolPCEntrySet.clear(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
817 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
818 |
void BsymRofsSymbolProcessUnit::ProcessArmv5File( const string& fileName, ifstream& aMap ){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
819 |
aMap.seekg (0, ios::beg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
820 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
821 |
char outbuffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
822 |
aMap.getline(str,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
823 |
boost::cmatch what; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
824 |
boost::regex reg("^ARM Linker"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
825 |
if(!regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
826 |
sprintf(outbuffer, "\nWarning: expecting %s to be generated by ARM linker\n", fileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
827 |
iStdoutLog.push_back(outbuffer); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
828 |
return; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
829 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
830 |
reg.assign("Global Symbols"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
831 |
boost::regex bss_search("^\\s*\\.bss\\s*0x(\\S+)\\s*.*$"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
832 |
bool hasValue = false; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
833 |
string bssStart; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
834 |
TUint32 bssSection = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
835 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
836 |
if(!hasValue && regex_search(str, what, bss_search)) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
837 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
838 |
hasValue = true; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
839 |
bssStart.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
840 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
841 |
if(regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
842 |
break; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
843 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
844 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
845 |
if(!bssStart.empty()) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
846 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
847 |
bssSection = strtol(bssStart.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
848 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
849 |
reg.assign("^\\s*(.+)\\s*0x(\\S+)\\s+[^\\d]*(\\d+)\\s+(.*)$"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
850 |
string sSym,sTmp,sSection,scopeName, symName; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
851 |
boost::regex regScope("^\\s*(\\w+)\\s*::\\s*(.*)$"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
852 |
unsigned int addr,size,baseOffset = 0; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
853 |
map<unsigned int, TSymbolPCEntry> syms; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
854 |
TUint32 dataStart = 0x400000; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
855 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
856 |
if(regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
857 |
sSym.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
858 |
sTmp.assign(what[2].first,what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
859 |
addr = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
860 |
sTmp.assign(what[3].first,what[3].second-what[3].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
861 |
size = strtol(sTmp.c_str(), NULL, 10); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
862 |
sSection.assign(what[4].first,what[4].second-what[4].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
863 |
if(sSection.find("(StubCode)") != string::npos) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
864 |
size = 8; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
865 |
if(addr > 0) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
866 |
if(baseOffset == 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
867 |
baseOffset = addr; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
868 |
unsigned int k = addr - baseOffset; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
869 |
if( (syms.find(k) == syms.end()) || size != 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
870 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
871 |
TSymbolPCEntry tmpEntry; |
712 | 872 |
if(regex_search(sSym.c_str(), what, regScope)) |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
873 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
874 |
scopeName.assign(what[1].first, what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
875 |
symName.assign(what[2].first, what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
876 |
tmpEntry.iScopeName = scopeName; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
877 |
tmpEntry.iName = symName; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
878 |
tmpEntry.iSecName = sSection; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
879 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
880 |
else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
881 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
882 |
tmpEntry.iScopeName = ""; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
883 |
tmpEntry.iName = sSym; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
884 |
tmpEntry.iSecName = sSection; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
885 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
886 |
tmpEntry.iSymbolEntry.iAddress = k; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
887 |
tmpEntry.iSymbolEntry.iLength = size; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
888 |
syms[k]=tmpEntry; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
889 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
890 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
891 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
892 |
// end of addr>0 |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
893 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
894 |
// end of regex_search |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
895 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
896 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
897 |
map<unsigned int, TSymbolPCEntry>::iterator it; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
898 |
for(it = syms.begin(); it != syms.end(); it++) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
899 |
unsigned int addr = it->first; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
900 |
if(addr < dataStart) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
901 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
902 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
903 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
904 |
else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
905 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
906 |
if(bssSection > 0 && addr >= bssSection) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
907 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
908 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iBssSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
909 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
910 |
else |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
911 |
{ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
912 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
913 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
914 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
915 |
iMapFileInfo.iSymbolPCEntrySet.push_back(it->second); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
916 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
917 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
918 |
void BsymRofsSymbolProcessUnit::ProcessGcceOrArm4File( const string& fileName, ifstream& aMap ){ |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
919 |
aMap.seekg (0, ios_base::beg); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
920 |
char str[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
921 |
char outbuffer[MAX_LINE]; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
922 |
aMap.getline(str,MAX_LINE); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
923 |
boost::cmatch what; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
924 |
boost::regex reg("^\\.text\\s+"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
925 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
926 |
if(regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
927 |
break; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
928 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
929 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
930 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
931 |
reg.assign("^\\.text\\s+(\\w+)\\s+\\w+"); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
932 |
if(!regex_search(str, what, reg)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
933 |
sprintf(outbuffer, "ERROR: Can't get .text section info for \"%s\"\n",fileName.c_str()); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
934 |
iStdoutLog.push_back(outbuffer); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
935 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
936 |
else { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
937 |
string sTmp, sLibFile; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
938 |
sTmp.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
939 |
unsigned int imgText = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
940 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
941 |
reg.assign("^LONG 0x.*", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
942 |
boost::cmatch what1; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
943 |
boost::regex reg1("^\\s(\\.text)?\\s+(0x\\w+)\\s+(0x\\w+)\\s+(.*)$", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
944 |
boost::regex reg2("^\\s+(\\w+)\\s\\s+([a-zA-Z_].+)", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
945 |
boost::regex reg3(".*lib\\(.*d\\d*s_?\\d{5}.o\\)$", boost::regex::icase); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
946 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
947 |
map<unsigned int,string> syms; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
948 |
unsigned int addr, len, stubhex; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
949 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
950 |
while(aMap.getline(str,MAX_LINE)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
951 |
if(strlen(str) == 0) |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
952 |
break; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
953 |
else if(regex_search(str, what, reg1)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
954 |
sLibFile.assign(what[4].first,what[4].second-what[4].first); |
712 | 955 |
if(!regex_search(sLibFile.c_str(), what1, reg)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
956 |
sTmp.assign(what[2].first,what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
957 |
addr = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
958 |
sTmp.assign(what[3].first,what[3].second-what[3].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
959 |
len = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
960 |
syms[addr+len] = ""; |
712 | 961 |
if(regex_search(sLibFile.c_str(), what, reg3)) { |
695
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
962 |
stubhex = addr; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
963 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
964 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
965 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
966 |
else if(regex_search(str, what, reg2)) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
967 |
sTmp.assign(what[1].first,what[1].second-what[1].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
968 |
addr = strtol(sTmp.c_str(), NULL, 16); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
969 |
sTmp.assign(what[2].first,what[2].second-what[2].first); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
970 |
syms[addr] = (addr == stubhex)? ("stub "+sTmp) : sTmp; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
971 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
972 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
973 |
|
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
974 |
map<unsigned int,string>::iterator it = syms.begin(); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
975 |
map<unsigned int,string>::iterator itp = it++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
976 |
TSymbolPCEntry tmpSymbolEntry; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
977 |
for(; it != syms.end(); itp = it++) { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
978 |
if(itp->second != "") { |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
979 |
tmpSymbolEntry.iSymbolEntry.iAddress = itp->first-imgText; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
980 |
tmpSymbolEntry.iSymbolEntry.iLength = it->first-itp->first; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
981 |
tmpSymbolEntry.iName = it->second; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
982 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++; |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
983 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpSymbolEntry); |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
984 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
985 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
986 |
} |
46ca13b54f56
features: bsym for rofsbuild and log input support for rombuild
marvin shi <marvin.shi@nokia.com>
parents:
diff
changeset
|
987 |
} |
714
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
988 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
989 |
// BsymRomSymbolProcessUnit start |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
990 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
991 |
void BsymRomSymbolProcessUnit::ProcessEntry(const TPlacedEntry& aEntry) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
992 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
993 |
iPlacedEntry = aEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
994 |
SymbolProcessUnit::ProcessEntry(aEntry); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
995 |
iMapFileInfo.iDbgUnitPCEntry.iPCName = aEntry.iFileName; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
996 |
iMapFileInfo.iDbgUnitPCEntry.iDevName = aEntry.iDevFileName; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
997 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
998 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
999 |
void BsymRomSymbolProcessUnit::ProcessExecutableFile(const string& aFile) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1000 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1001 |
ResetContentLog(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1002 |
char str[MAX_LINE]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1003 |
string mapFile2 = aFile+".map"; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1004 |
size_t dot = aFile.rfind('.'); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1005 |
string mapFile = aFile.substr(0,dot)+".map"; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1006 |
ifstream fMap; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1007 |
fMap.open(mapFile2.c_str()); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1008 |
if(!fMap.is_open()) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1009 |
fMap.open(mapFile.c_str()); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1010 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1011 |
if(!fMap.is_open()) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1012 |
sprintf(str, "\nWarning: Can't open \"%s\" or \"%s\"\n",mapFile2.c_str(),mapFile.c_str()); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1013 |
iStdoutLog.push_back(str); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1014 |
TSymbolPCEntry tmpEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1015 |
tmpEntry.iSymbolEntry.iAddress = iPlacedEntry.iCodeAddress; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1016 |
tmpEntry.iSymbolEntry.iLength = iPlacedEntry.iTotalSize; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1017 |
tmpEntry.iName = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1018 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1019 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1020 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1021 |
else { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1022 |
if(!fMap.good()) fMap.clear(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1023 |
char buffer[100]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1024 |
fMap.getline(buffer, 100); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1025 |
boost::regex regARMV5("ARM Linker", boost::regex::icase); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1026 |
boost::regex regGCCEoARMV4("Archive member included", boost::regex::icase); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1027 |
boost::cmatch what; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1028 |
if(regex_search(buffer, what, regARMV5)) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1029 |
ProcessArmv5File(aFile, fMap); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1030 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1031 |
else if(regex_search(buffer, what, regGCCEoARMV4)) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1032 |
ProcessGcceOrArm4File(aFile, fMap); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1033 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1034 |
else { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1035 |
fMap.seekg(0, ios_base::beg); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1036 |
ProcessX86File(aFile, fMap); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1037 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1038 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1039 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1040 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1041 |
void BsymRomSymbolProcessUnit::ProcessArmv5File(const string& fileName, ifstream& aMap) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1042 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1043 |
string symName ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1044 |
ArmSymMap symbols ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1045 |
vector<char*> words ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1046 |
ArmSymbolInfo info; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1047 |
char* lineStart ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1048 |
char buffer[MAX_LINE]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1049 |
while(aMap.good() && (!aMap.eof())){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1050 |
*buffer = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1051 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1052 |
lineStart = buffer ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1053 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1054 |
if(strstr(lineStart,"Global Symbols")) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1055 |
break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1056 |
char* armstamp = strstr(lineStart,"ARM Code"); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1057 |
if(0 == armstamp) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1058 |
armstamp = strstr(lineStart,"Thumb Code") ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1059 |
if(0 == armstamp) continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1060 |
*(armstamp - 1) = 0 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1061 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1062 |
char* hexStr = lineStart ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1063 |
char* nameEnd; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1064 |
while(1) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1065 |
hexStr = strstr(hexStr,"0x"); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1066 |
if(0 == hexStr) break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1067 |
nameEnd = hexStr - 1; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1068 |
if(*nameEnd == ' ' || *nameEnd == '\t') break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1069 |
hexStr += 2 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1070 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1071 |
if(0 == hexStr) continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1072 |
while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t')) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1073 |
nameEnd -- ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1074 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1075 |
nameEnd[1] = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1076 |
info.name = lineStart; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1077 |
char* temp ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1078 |
TUint32 addr = strtoul(hexStr + 2,&temp,16); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1079 |
char* decStr ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1080 |
if(*armstamp == 'A') |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1081 |
decStr = armstamp + 9 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1082 |
else |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1083 |
decStr = armstamp + 11 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1084 |
SKIP_WS(decStr); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1085 |
info.size = strtoul(decStr,&temp,10); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1086 |
SKIP_WS(temp); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1087 |
info.section = temp; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1088 |
if(info.section.find("(StubCode)") != string::npos ) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1089 |
info.size = 8 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1090 |
if(addr > 0){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1091 |
symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info)); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1092 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1093 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1094 |
size_t lenOfFileName = iPlacedEntry.iFileName.length(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1095 |
while(aMap.good() && (!aMap.eof())){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1096 |
*buffer = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1097 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1098 |
lineStart = buffer ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1099 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1100 |
char* hexStr = lineStart ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1101 |
char* nameEnd; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1102 |
while(1) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1103 |
hexStr = strstr(hexStr,"0x"); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1104 |
if(0 == hexStr) break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1105 |
nameEnd = hexStr - 1; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1106 |
if(*nameEnd == ' ' || *nameEnd == '\t') |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1107 |
break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1108 |
hexStr += 2 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1109 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1110 |
if(0 == hexStr) continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1111 |
while(nameEnd > lineStart && (*nameEnd == ' ' || *nameEnd == '\t')){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1112 |
nameEnd -- ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1113 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1114 |
nameEnd[1] = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1115 |
info.name = lineStart; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1116 |
char *temp ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1117 |
TUint32 addr = strtoul(hexStr + 2,&temp,16); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1118 |
while(*temp < '0' || *temp > '9' )//[^\d]* |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1119 |
temp++ ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1120 |
char* decStr = temp ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1121 |
info.size = strtoul(decStr,&temp,10); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1122 |
SKIP_WS(temp); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1123 |
info.section = temp; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1124 |
if(info.section.find("(StubCode)") != string::npos ) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1125 |
info.size = 8 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1126 |
if(addr > 0){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1127 |
symbols.insert(pair<TUint32,ArmSymbolInfo>(addr,info)); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1128 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1129 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1130 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1131 |
TUint32 textSectAddr = 0x00008000; // .text gets linked at 0x00008000 |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1132 |
TUint32 dataSectAddr = 0x00400000 ; // .data gets linked at 0x00400000 |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1133 |
size_t allocBytes; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1134 |
boost::regex regScope("^\\s*(\\w+)\\s*::\\s*(.*)$"); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1135 |
boost::cmatch what; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1136 |
for( ArmSymMap::iterator it = symbols.begin(); it != symbols.end() ; it++){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1137 |
TSymbolPCEntry tmpEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1138 |
TUint32 thisAddr = it->first ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1139 |
TUint32 romAddr ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1140 |
ArmSymbolInfo& info = it->second; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1141 |
if (thisAddr >= textSectAddr && thisAddr <= (textSectAddr + iPlacedEntry.iTextSize)) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1142 |
romAddr = thisAddr - textSectAddr + iPlacedEntry.iCodeAddress ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1143 |
tmpEntry.iSymbolEntry.iAddress = romAddr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1144 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1145 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1146 |
else if ( iPlacedEntry.iDataAddress && |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1147 |
( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr + iPlacedEntry.iTextSize))) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1148 |
romAddr = thisAddr-dataSectAddr + iPlacedEntry.iDataBssLinearBase; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1149 |
tmpEntry.iSymbolEntry.iAddress = romAddr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1150 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1151 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1152 |
else if ( iPlacedEntry.iDataBssLinearBase && |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1153 |
( thisAddr >= dataSectAddr && thisAddr <= (dataSectAddr+ iPlacedEntry.iTotalDataSize))) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1154 |
romAddr = thisAddr - dataSectAddr + iPlacedEntry.iDataBssLinearBase; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1155 |
tmpEntry.iSymbolEntry.iAddress = romAddr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1156 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iBssSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1157 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1158 |
else { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1159 |
allocBytes = info.name.length() + 60; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1160 |
char* msg = new char[allocBytes] ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1161 |
snprintf(msg,allocBytes,"\r\nWarning: Symbol %s @ 0x%08x not in text or data segments\r\n", \ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1162 |
info.name.c_str() ,(unsigned int)thisAddr) ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1163 |
iStdoutLog.push_back(msg); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1164 |
allocBytes = lenOfFileName + 80; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1165 |
msg = new char[allocBytes]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1166 |
snprintf(msg,allocBytes,"Warning: The map file for binary %s is out-of-sync with the binary itself\r\n\r\n",iPlacedEntry.iFileName.c_str()); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1167 |
iStdoutLog.push_back(msg); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1168 |
continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1169 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1170 |
tmpEntry.iSymbolEntry.iLength = info.size; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1171 |
if(regex_search(info.name.c_str(), what, regScope)) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1172 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1173 |
tmpEntry.iScopeName.assign(what[1].first, what[1].second-what[1].first); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1174 |
tmpEntry.iName.assign(what[2].first, what[2].second-what[2].first); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1175 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1176 |
else |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1177 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1178 |
tmpEntry.iScopeName = ""; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1179 |
tmpEntry.iName = info.name; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1180 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1181 |
tmpEntry.iSecName = info.section; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1182 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1183 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1184 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1185 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1186 |
void BsymRomSymbolProcessUnit::ProcessGcceOrArm4File(const string& fileName, ifstream& aMap) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1187 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1188 |
char* lineStart; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1189 |
vector<char*> words ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1190 |
char buffer[MAX_LINE]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1191 |
while(aMap.good() && (!aMap.eof())){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1192 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1193 |
lineStart = buffer ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1194 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1195 |
if( 0 == strncmp(lineStart,".text",5)) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1196 |
lineStart += 5; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1197 |
break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1198 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1199 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1200 |
split(lineStart,words); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1201 |
TUint32 codeAddr , codeSize; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1202 |
size_t allocBytes ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1203 |
if(words.size() != 2 || |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1204 |
KErrNone != Val(codeAddr,words.at(0)) || |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1205 |
KErrNone != Val(codeSize,words.at(1))) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1206 |
allocBytes = iPlacedEntry.iFileName.length() + 60; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1207 |
char* msg = new char[allocBytes]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1208 |
snprintf(msg,allocBytes,"\nError: Can't get .text section info for \"%s\"\r\n",iPlacedEntry.iFileName.c_str()); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1209 |
iStdoutLog.push_back(msg); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1210 |
return; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1211 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1212 |
map<TUint32,string> symbols ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1213 |
TUint32 stubHex = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1214 |
//Slurp symbols 'til the end of the text section |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1215 |
while(aMap.good() && (!aMap.eof())){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1216 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1217 |
lineStart = buffer ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1218 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1219 |
if(0 == *lineStart) break ; //blank line marks the end of the text section |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1220 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1221 |
// .text <addr> <len> <library(member)> |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1222 |
// .text$something |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1223 |
// <addr> <len> <library(member)> |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1224 |
// <addr> <len> LONG 0x0 |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1225 |
// (/^\s(\.text)?\s+(0x\w+)\s+(0x\w+)\s+(.*)$/io) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1226 |
if(strncmp(lineStart,".text",5) == 0){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1227 |
lineStart += 5 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1228 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1229 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1230 |
char* hex1 = NULL ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1231 |
char* hex2 = NULL ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1232 |
char* strAfterhex1 = NULL ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1233 |
TUint32 addr,size ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1234 |
if(strncmp(lineStart,"0x",2) == 0){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1235 |
hex1 = lineStart + 2; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1236 |
char* temp ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1237 |
addr = strtoul(hex1,&temp,16); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1238 |
SKIP_WS(temp); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1239 |
strAfterhex1 = temp ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1240 |
if(strncmp(temp,"0x",2) == 0){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1241 |
hex2 = temp + 2 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1242 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1243 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1244 |
if(NULL != hex2){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1245 |
char* libraryfile ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1246 |
size = strtoul(hex2,&libraryfile,16); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1247 |
SKIP_WS(libraryfile); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1248 |
TUint32 key = addr + size ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1249 |
put_to_map(symbols,key,string(""));//impossible symbol as end marker |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1250 |
make_lower(libraryfile); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1251 |
size_t len = strlen(libraryfile); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1252 |
char* p1 = strstr(libraryfile,".lib("); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1253 |
if(NULL == p1) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1254 |
continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1255 |
p1 += 5; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1256 |
if(strcmp(libraryfile + len - 3,".o)")!= 0) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1257 |
continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1258 |
len -= 3 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1259 |
libraryfile[len] = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1260 |
if(EFalse == IsValidNumber(libraryfile + len - 5)) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1261 |
continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1262 |
len -= 7 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1263 |
if('_' == libraryfile[len]) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1264 |
len -- ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1265 |
if('s' != libraryfile[len]) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1266 |
continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1267 |
char* p2 = libraryfile + len - 1; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1268 |
while(p2 > p1 ) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1269 |
if(*p2 < '0' || *p2 > '9') |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1270 |
break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1271 |
p2 -- ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1272 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1273 |
if(*p2 != 'd') |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1274 |
continue ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1275 |
stubHex = addr ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1276 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1277 |
else if(NULL != hex1 && NULL != strAfterhex1){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1278 |
//# <addr> <symbol name possibly including spaces> |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1279 |
//(/^\s+(\w+)\s\s+([a-zA-Z_].+)/o) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1280 |
char* symName = strAfterhex1; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1281 |
if((*symName >= 'A' && *symName <= 'Z') || |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1282 |
(*symName >= 'a' && *symName <= 'z') || *symName == '_') { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1283 |
string symbol(symName); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1284 |
if(addr == stubHex) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1285 |
symbol.insert(0,"stub "); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1286 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1287 |
put_to_map(symbols,addr,symbol); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1288 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1289 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1290 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1291 |
map<TUint32,string>::iterator it = symbols.begin(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1292 |
TUint32 lastAddr = it->first; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1293 |
string lastSymName = it->second; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1294 |
vector<pair<int,char*> >lines ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1295 |
it ++ ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1296 |
while(it != symbols.end()) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1297 |
TSymbolPCEntry tmpEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1298 |
TUint32 addr = it->first ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1299 |
unsigned int fixedupAddr = lastAddr - codeAddr + iPlacedEntry.iCodeAddress; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1300 |
TUint size = addr - lastAddr ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1301 |
if(!lastSymName.empty()) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1302 |
tmpEntry.iSymbolEntry.iAddress = fixedupAddr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1303 |
tmpEntry.iSymbolEntry.iLength = size; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1304 |
tmpEntry.iScopeName = ""; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1305 |
tmpEntry.iName = lastSymName; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1306 |
tmpEntry.iSecName = ""; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1307 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1308 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1309 |
lastAddr = addr ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1310 |
lastSymName = it->second; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1311 |
it ++ ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1312 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1313 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1314 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1315 |
void BsymRomSymbolProcessUnit::ProcessX86File(const string& fileName, ifstream& aMap) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1316 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1317 |
char buffer[MAX_LINE]; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1318 |
char* lineStart; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1319 |
while(aMap.good() && (!aMap.eof())){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1320 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1321 |
lineStart = buffer ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1322 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1323 |
if( 0 == strncmp(lineStart,"Address",7)) { |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1324 |
break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1325 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1326 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1327 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1328 |
string lastName ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1329 |
TUint32 lastAddr = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1330 |
vector<pair<int, char*> >lines ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1331 |
while(aMap.good() && (!aMap.eof())){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1332 |
TSymbolPCEntry tmpEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1333 |
aMap.getline(buffer,MAX_LINE); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1334 |
lineStart = buffer ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1335 |
SKIP_WS(lineStart); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1336 |
if(0 != strncmp(lineStart,"0001:",5)) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1337 |
break ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1338 |
char* end ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1339 |
TUint32 addr = strtoul(lineStart + 5,&end,16); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1340 |
char* name = end + 1; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1341 |
SKIP_WS(name); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1342 |
end = name + 1; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1343 |
FIND_WS(end); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1344 |
*end = 0 ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1345 |
if(!lastName.empty()){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1346 |
unsigned int size = addr - lastAddr ; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1347 |
unsigned int romAddr = lastAddr + iPlacedEntry.iCodeAddress; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1348 |
tmpEntry.iSymbolEntry.iAddress = romAddr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1349 |
tmpEntry.iSymbolEntry.iLength = size; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1350 |
tmpEntry.iName = lastName; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1351 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1352 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1353 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1354 |
lastName = name; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1355 |
lastAddr = addr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1356 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1357 |
if(!lastName.empty()){ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1358 |
TSymbolPCEntry tmpEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1359 |
unsigned int romAddr = lastAddr + iPlacedEntry.iCodeAddress; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1360 |
tmpEntry.iSymbolEntry.iAddress = romAddr; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1361 |
tmpEntry.iSymbolEntry.iLength = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1362 |
tmpEntry.iName = lastName; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1363 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1364 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iCodeSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1365 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1366 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1367 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1368 |
void BsymRomSymbolProcessUnit::FlushSymbolContent(ostream &aOut) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1369 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1370 |
iSymbolGeneratorPtr->AppendMapFileInfo(iMapFileInfo); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1371 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1372 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1373 |
void BsymRomSymbolProcessUnit::ResetContentLog() |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1374 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1375 |
iStdoutLog.clear(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1376 |
iMapFileInfo.iDbgUnitPCEntry.iPCName = ""; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1377 |
iMapFileInfo.iDbgUnitPCEntry.iDevName = ""; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1378 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.Reset(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1379 |
iMapFileInfo.iSymbolPCEntrySet.clear(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1380 |
} |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1381 |
|
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1382 |
void BsymRomSymbolProcessUnit::ProcessDataFile(const string& aFile) |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1383 |
{ |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1384 |
ResetContentLog(); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1385 |
string basename = aFile.substr(aFile.rfind(PATH_SEPARATOR)+1); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1386 |
TSymbolPCEntry tmpEntry; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1387 |
tmpEntry.iSymbolEntry.iAddress = iPlacedEntry.iDataAddress; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1388 |
tmpEntry.iSymbolEntry.iLength = 0; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1389 |
tmpEntry.iName = basename; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1390 |
iMapFileInfo.iSymbolPCEntrySet.push_back(tmpEntry); |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1391 |
iMapFileInfo.iDbgUnitPCEntry.iDbgUnitEntry.iDataSymbolCount++; |
e5a58c351011
feature bsym format symbol rombuild support
marvin shi <marvin.shi@nokia.com>
parents:
712
diff
changeset
|
1392 |
} |