summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-16 08:11:09 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-16 08:11:09 +0000
commit93d16c699360d86db811ba3471c7f7fb09cb2d4b (patch)
treef37976e646cef69d9ae4b3620d5cdfb036ceae0e /Tools
parent497ef745f0719f3dffc5f4be45aa3652a52f2316 (diff)
downloadedk2-93d16c699360d86db811ba3471c7f7fb09cb2d4b.zip
edk2-93d16c699360d86db811ba3471c7f7fb09cb2d4b.tar.gz
edk2-93d16c699360d86db811ba3471c7f7fb09cb2d4b.tar.bz2
1. Change "BA" to "BaseAddress" and "EP" to "EntryPoint".
2. Sort modules by their preferred load address in ascending order. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2254 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r--Tools/CCode/Source/GenFvMap/GenFvMap.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/Tools/CCode/Source/GenFvMap/GenFvMap.cpp b/Tools/CCode/Source/GenFvMap/GenFvMap.cpp
index 881251f..5da45ab 100644
--- a/Tools/CCode/Source/GenFvMap/GenFvMap.cpp
+++ b/Tools/CCode/Source/GenFvMap/GenFvMap.cpp
@@ -13,6 +13,7 @@
#include <stdexcept>
#include <list>
#include <map>
+#include <vector>
#include <iomanip>
#include <fstream>
#include <sstream>
@@ -349,31 +350,47 @@ CFvMapFile::CFvMapFile(const CIdAddressPathMap& idAddrPath)
}
}
+CFvMapFile::~CFvMapFile(void)
+{
+ Cleanup();
+}
+
void CFvMapFile::Cleanup(void)
{
for (iterator i = begin(); i != end(); i++)
delete i->second;
}
+static bool map_less(const CFvMapFile::const_iterator& l, const CFvMapFile::const_iterator& r)
+{
+ return l->second->m_ullLoadAddr < r->second->m_ullLoadAddr;
+}
+
ostream& operator << (ostream& os, const CFvMapFile& fvMap)
{
- for (CFvMapFile::const_iterator i = fvMap.begin(); !!os && i != fvMap.end(); i++)
+ vector<CFvMapFile::const_iterator> rgIter;
+ rgIter.reserve(fvMap.size());
+ for (CFvMapFile::const_iterator i = fvMap.begin(); i != fvMap.end(); i++)
+ rgIter.push_back(i);
+ sort(rgIter.begin(), rgIter.end(), map_less);
+
+ for (vector<CFvMapFile::const_iterator>::const_iterator i = rgIter.begin(); i != rgIter.end(); i++)
{
- CMapFile::const_iterator j = i->second->begin();
- while (j != i->second->end() && j->m_strAddress != i->second->m_strEntryPoint) j++;
- if (j == i->second->end())
+ CMapFile::const_iterator j = (*i)->second->begin();
+ while (j != (*i)->second->end() && j->m_strAddress != (*i)->second->m_strEntryPoint) j++;
+ if (j == (*i)->second->end())
throw runtime_error(
__FUNCTION__ ":Entry point not found for module " +
- i->second->m_strModuleName);
+ (*i)->second->m_strModuleName);
os << hex
- << i->second->m_strModuleName
- << " (EP=" << j->m_ullRva
- << ", BA=" << i->second->m_ullLoadAddr
- << ", GUID=" << i->first
+ << (*i)->second->m_strModuleName
+ << " (EntryPoint=" << j->m_ullRva
+ << ", BaseAddress=" << (*i)->second->m_ullLoadAddr
+ << ", GUID=" << (*i)->first
<< ")" << endl << endl;
- for (j = i->second->begin(); j != i->second->end(); j++)
+ for (j = (*i)->second->begin(); j != (*i)->second->end(); j++)
os << " " << *j << endl;
os << endl << endl;
@@ -382,11 +399,6 @@ ostream& operator << (ostream& os, const CFvMapFile& fvMap)
return os;
}
-CFvMapFile::~CFvMapFile(void)
-{
- Cleanup();
-}
-
class CGenFvMapUsage : public invalid_argument
{
public: