|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
1 #include <boost/regex.hpp> |
18 #include <boost/regex.hpp> |
2 #define MAX_LINE 65535 |
19 #define MAX_LINE 65535 |
3 #include "symbolgenerator.h" |
20 #include "symbolgenerator.h" |
4 #include "e32image.h" |
21 #include "e32image.h" |
5 |
22 |
69 else { |
86 else { |
70 if(!fMap.good()) fMap.clear(); |
87 if(!fMap.good()) fMap.clear(); |
71 boost::regex regARMV5("ARMV5", boost::regex::icase); |
88 boost::regex regARMV5("ARMV5", boost::regex::icase); |
72 boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase); |
89 boost::regex regGCCEoARMV4("(GCCE|ARMV4)", boost::regex::icase); |
73 boost::cmatch what; |
90 boost::cmatch what; |
74 if(regex_search(fileName, what, regARMV5)) { |
91 if(regex_search(fileName.c_str(), what, regARMV5)) { |
75 ProcessArmv5File(fileName, fMap); |
92 ProcessArmv5File(fileName, fMap); |
76 } |
93 } |
77 else if(regex_search(fileName, what, regGCCEoARMV4)) { |
94 else if(regex_search(fileName.c_str(), what, regGCCEoARMV4)) { |
78 ProcessGcceOrArm4File(fileName, fMap); |
95 ProcessGcceOrArm4File(fileName, fMap); |
79 } |
96 } |
80 else { |
97 else { |
81 printf("\nWarning: cannot determine linker type used to create %s\n",fileName.c_str()); |
98 printf("\nWarning: cannot determine linker type used to create %s\n",fileName.c_str()); |
82 outString = "00000000 0000 "; |
99 outString = "00000000 0000 "; |
183 while(aMap.getline(str,MAX_LINE)) { |
200 while(aMap.getline(str,MAX_LINE)) { |
184 if(strlen(str) == 0) |
201 if(strlen(str) == 0) |
185 break; |
202 break; |
186 else if(regex_search(str, what, reg1)) { |
203 else if(regex_search(str, what, reg1)) { |
187 sLibFile.assign(what[4].first,what[4].second-what[4].first); |
204 sLibFile.assign(what[4].first,what[4].second-what[4].first); |
188 if(!regex_search(sLibFile, what1, reg)) { |
205 if(!regex_search(sLibFile.c_str(), what1, reg)) { |
189 sTmp.assign(what[2].first,what[2].second-what[2].first); |
206 sTmp.assign(what[2].first,what[2].second-what[2].first); |
190 addr = strtol(sTmp.c_str(), NULL, 16); |
207 addr = strtol(sTmp.c_str(), NULL, 16); |
191 sTmp.assign(what[3].first,what[3].second-what[3].first); |
208 sTmp.assign(what[3].first,what[3].second-what[3].first); |
192 len = strtol(sTmp.c_str(), NULL, 16); |
209 len = strtol(sTmp.c_str(), NULL, 16); |
193 syms[addr+len] = ""; |
210 syms[addr+len] = ""; |
194 if(regex_search(sLibFile, what, reg3)) { |
211 if(regex_search(sLibFile.c_str(), what, reg3)) { |
195 stubhex = addr; |
212 stubhex = addr; |
196 } |
213 } |
197 } |
214 } |
198 } |
215 } |
199 else if(regex_search(str, what, reg2)) { |
216 else if(regex_search(str, what, reg2)) { |