summaryrefslogtreecommitdiff
path: root/base/loader
diff options
context:
space:
mode:
authorAndrew Schultz <alschult@umich.edu>2004-05-06 15:21:07 -0400
committerAndrew Schultz <alschult@umich.edu>2004-05-06 15:21:07 -0400
commit4a5dcc37bfb26c152c195061fa70c7aa246b5ca6 (patch)
tree7c74980b640a7ffdca5bf601a0363c62b6b38257 /base/loader
parent8538ffdb3682d71c90c33b92b436a2d9cbdc42c3 (diff)
downloadgem5-4a5dcc37bfb26c152c195061fa70c7aa246b5ca6.tar.xz
Whole mess'o'changes.. see individual files
arch/alpha/vtophys.cc: Removed buggy code that tries to fix PAL addresses (may cause problems while trying to debug in PAL code, but that should do this fix outside of vtophys) base/loader/symtab.cc: base/loader/symtab.hh: cpu/exetrace.cc: Changed InstExec traces to always print a symbol name dev/ide_ctrl.cc: dev/ide_disk.cc: Tabs dev/ide_disk.hh: Change buffer size dev/tsunami_pchip.cc: Fix translatePciToDma to support scatter gather mapping kern/linux/linux_system.cc: Force simulator to wait until remote debugger attaches (should be removed or turned on/off with a flag) --HG-- extra : convert_revision : 1d08aebe3f448c87a963dd613de3e2e0cff0d48d
Diffstat (limited to 'base/loader')
-rw-r--r--base/loader/symtab.cc25
-rw-r--r--base/loader/symtab.hh7
2 files changed, 29 insertions, 3 deletions
diff --git a/base/loader/symtab.cc b/base/loader/symtab.cc
index 075c197a6..cb18d499c 100644
--- a/base/loader/symtab.cc
+++ b/base/loader/symtab.cc
@@ -95,6 +95,31 @@ SymbolTable::load(const string &filename)
}
bool
+SymbolTable::findNearestSymbol(Addr address, string &symbol) const
+{
+ ATable::const_iterator i = addrTable.lower_bound(address);
+
+ // check for PALCode
+ if (address & 0x1)
+ return false;
+
+ // first check for the end
+ if (i == addrTable.end())
+ i--;
+ else if (i == addrTable.begin() && (*i).first != address)
+ return false;
+ else if ((*i).first != address)
+ i--;
+
+ symbol = (*i).second;
+
+ if (address != (*i).first)
+ symbol += csprintf("+%d", address - (*i).first);
+
+ return true;
+}
+
+bool
SymbolTable::findSymbol(Addr address, string &symbol) const
{
ATable::const_iterator i = addrTable.find(address);
diff --git a/base/loader/symtab.hh b/base/loader/symtab.hh
index 49a811018..1502e4250 100644
--- a/base/loader/symtab.hh
+++ b/base/loader/symtab.hh
@@ -29,14 +29,14 @@
#ifndef __SYMTAB_HH__
#define __SYMTAB_HH__
-#include "base/hashmap.hh"
+#include <map>
#include "targetarch/isa_traits.hh" // for Addr
class SymbolTable
{
private:
- typedef m5::hash_map<Addr, std::string> ATable;
- typedef m5::hash_map<std::string, Addr> STable;
+ typedef std::map<Addr, std::string> ATable;
+ typedef std::map<std::string, Addr> STable;
ATable addrTable;
STable symbolTable;
@@ -49,6 +49,7 @@ class SymbolTable
bool insert(Addr address, std::string symbol);
bool load(const std::string &file);
+ bool findNearestSymbol(Addr address, std::string &symbol) const;
bool findSymbol(Addr address, std::string &symbol) const;
bool findAddress(const std::string &symbol, Addr &address) const;