summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/cprintf_formats.hh3
-rw-r--r--base/loader/elf_object.cc10
-rw-r--r--base/loader/symtab.cc25
-rw-r--r--base/loader/symtab.hh7
-rw-r--r--base/range.hh2
-rw-r--r--base/remote_gdb.cc12
6 files changed, 41 insertions, 18 deletions
diff --git a/base/cprintf_formats.hh b/base/cprintf_formats.hh
index d8a8a552b..120dd94b1 100644
--- a/base/cprintf_formats.hh
+++ b/base/cprintf_formats.hh
@@ -279,8 +279,6 @@ template <typename T>
inline void
format_integer(std::ostream &out, const T &data, Format &fmt)
{ _format_integer(out, data, fmt); }
-
-#if 0
inline void
format_integer(std::ostream &out, char data, Format &fmt)
{ _format_integer(out, data, fmt); }
@@ -290,6 +288,7 @@ format_integer(std::ostream &out, unsigned char data, Format &fmt)
inline void
format_integer(std::ostream &out, signed char data, Format &fmt)
{ _format_integer(out, data, fmt); }
+#if 0
inline void
format_integer(std::ostream &out, short data, Format &fmt)
{ _format_integer(out, data, fmt); }
diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc
index b8ffd2b10..a0c0c0551 100644
--- a/base/loader/elf_object.cc
+++ b/base/loader/elf_object.cc
@@ -191,7 +191,7 @@ bool
ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
{
Elf *elf;
- int secidx = 1; // there is a 0 but it is nothing, go figure
+ int sec_idx = 1; // there is a 0 but it is nothing, go figure
Elf_Scn *section;
GElf_Shdr shdr;
Elf_Data *data;
@@ -211,7 +211,7 @@ ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
assert(elf != NULL);
// Get the first section
- section = elf_getscn(elf, secidx);
+ section = elf_getscn(elf, sec_idx);
// While there are no more sections
while (section != NULL) {
@@ -226,14 +226,14 @@ ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
// loop through all the symbols, only loading global ones
for (ii = 0; ii < count; ++ii) {
gelf_getsym(data, ii, &sym);
- if (GELF_ST_BIND(sym.st_info) & binding) {
+ if (GELF_ST_BIND(sym.st_info) == binding) {
symtab->insert(sym.st_value,
elf_strptr(elf, shdr.sh_link, sym.st_name));
}
}
}
- ++secidx;
- section = elf_getscn(elf, secidx);
+ ++sec_idx;
+ section = elf_getscn(elf, sec_idx);
}
elf_end(elf);
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;
diff --git a/base/range.hh b/base/range.hh
index d72aa9755..2c4a43f48 100644
--- a/base/range.hh
+++ b/base/range.hh
@@ -225,7 +225,7 @@ inline bool
operator==(const T &pos, const Range<U> &range)
{
assert(range.valid());
- return pos >= range.start && pos < range.end;
+ return pos >= range.start && pos <= range.end;
}
/**
diff --git a/base/remote_gdb.cc b/base/remote_gdb.cc
index e20800d12..7b73d60e9 100644
--- a/base/remote_gdb.cc
+++ b/base/remote_gdb.cc
@@ -332,23 +332,21 @@ RemoteGDB::acc(Addr va, size_t len)
last_va = alpha_round_page(va + len);
do {
- if (va < ALPHA_K0SEG_BASE) {
- DPRINTF(GDBAcc, "acc: Mapping is invalid %#x < K0SEG\n", va);
- return false;
- }
-
- if (va < ALPHA_K1SEG_BASE) {
+ if (va >= ALPHA_K0SEG_BASE && va < ALPHA_K1SEG_BASE) {
if (va < (ALPHA_K0SEG_BASE + pmem->size())) {
DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= "
"%#x < K0SEG + size\n", va);
return true;
} else {
- DPRINTF(GDBAcc, "acc: Mapping is invalid %#x < K0SEG\n",
+ DPRINTF(GDBAcc, "acc: Mapping invalid %#x > K0SEG + size\n",
va);
return false;
}
}
+ if (PC_PAL(va) || va < 0x10000)
+ return true;
+
Addr ptbr = context->regs.ipr[AlphaISA::IPR_PALtemp20];
pte = kernel_pte_lookup(pmem, ptbr, va);
if (!pte || !entry_valid(pmem->phys_read_qword(pte))) {