summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/loader/symtab.cc7
-rw-r--r--src/base/loader/symtab.hh4
2 files changed, 7 insertions, 4 deletions
diff --git a/src/base/loader/symtab.cc b/src/base/loader/symtab.cc
index 439394852..853d98cc4 100644
--- a/src/base/loader/symtab.cc
+++ b/src/base/loader/symtab.cc
@@ -56,12 +56,13 @@ SymbolTable::insert(Addr address, string symbol)
if (symbol.empty())
return false;
- if (!addrTable.insert(make_pair(address, symbol)).second)
- return false;
-
if (!symbolTable.insert(make_pair(symbol, address)).second)
return false;
+ // There can be multiple symbols for the same address, so always
+ // update the addrTable multimap when we see a new symbol name.
+ addrTable.insert(make_pair(address, symbol));
+
return true;
}
diff --git a/src/base/loader/symtab.hh b/src/base/loader/symtab.hh
index 403cb13ac..bd0406b74 100644
--- a/src/base/loader/symtab.hh
+++ b/src/base/loader/symtab.hh
@@ -42,7 +42,7 @@
class SymbolTable
{
public:
- typedef std::map<Addr, std::string> ATable;
+ typedef std::multimap<Addr, std::string> ATable;
typedef std::map<std::string, Addr> STable;
private:
@@ -87,6 +87,8 @@ class SymbolTable
if (i == addrTable.end())
return false;
+ // There are potentially multiple symbols that map to the same
+ // address. For simplicity, just return the first one.
symbol = (*i).second;
return true;
}