summaryrefslogtreecommitdiff
path: root/src/arch/arm/insts
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-06-27 00:29:30 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-06-27 00:29:30 -0700
commit56f1845471231f6b063a912c79c38e63cfbd7d59 (patch)
tree5648cc08a6751361fd94acfc12126ebc8ba6cee6 /src/arch/arm/insts
parenta4ac3fad7a9a6c48fdde3d42e35b113bbd03eacf (diff)
downloadgem5-56f1845471231f6b063a912c79c38e63cfbd7d59.tar.xz
ARM: Show branch targets relative to the nearest symbol.
Diffstat (limited to 'src/arch/arm/insts')
-rw-r--r--src/arch/arm/insts/branch.cc9
-rw-r--r--src/arch/arm/insts/static_inst.cc18
-rw-r--r--src/arch/arm/insts/static_inst.hh4
3 files changed, 25 insertions, 6 deletions
diff --git a/src/arch/arm/insts/branch.cc b/src/arch/arm/insts/branch.cc
index 39ad041c8..3deb380f8 100644
--- a/src/arch/arm/insts/branch.cc
+++ b/src/arch/arm/insts/branch.cc
@@ -71,14 +71,11 @@ Branch::generateDisassembly(Addr pc, const SymbolTable *symtab) const
std::stringstream ss;
printMnemonic(ss);
+ ss << "\t";
Addr target = pc + 8 + disp;
-
- std::string str;
- if (symtab && symtab->findSymbol(target, str))
- ss << str;
- else
- ccprintf(ss, "0x%x", target);
+ ccprintf(ss, "%#x", target);
+ printMemSymbol(ss, symtab, " <", target, ">");
return ss.str();
}
diff --git a/src/arch/arm/insts/static_inst.cc b/src/arch/arm/insts/static_inst.cc
index 6b641d8bb..a76dbd69c 100644
--- a/src/arch/arm/insts/static_inst.cc
+++ b/src/arch/arm/insts/static_inst.cc
@@ -29,6 +29,7 @@
#include "arch/arm/insts/static_inst.hh"
#include "base/condcodes.hh"
+#include "base/loader/symtab.hh"
namespace ArmISA
{
@@ -309,6 +310,23 @@ ArmStaticInst::printMnemonic(std::ostream &os,
}
}
+void
+ArmStaticInst::printMemSymbol(std::ostream &os,
+ const SymbolTable *symtab,
+ const std::string &prefix,
+ const Addr addr,
+ const std::string &suffix) const
+{
+ Addr symbolAddr;
+ std::string symbol;
+ if (symtab && symtab->findNearestSymbol(addr, symbol, symbolAddr)) {
+ ccprintf(os, "%s%s", prefix, symbol);
+ if (symbolAddr != addr)
+ ccprintf(os, "+%d", addr - symbolAddr);
+ ccprintf(os, suffix);
+ }
+}
+
std::string
ArmStaticInst::generateDisassembly(Addr pc,
const SymbolTable *symtab) const
diff --git a/src/arch/arm/insts/static_inst.hh b/src/arch/arm/insts/static_inst.hh
index ca4cb0f64..6b745352e 100644
--- a/src/arch/arm/insts/static_inst.hh
+++ b/src/arch/arm/insts/static_inst.hh
@@ -65,6 +65,10 @@ class ArmStaticInst : public StaticInst
void printMnemonic(std::ostream &os,
const std::string &suffix = "",
bool withPred = true) const;
+ void printMemSymbol(std::ostream &os, const SymbolTable *symtab,
+ const std::string &prefix, const Addr addr,
+ const std::string &suffix) const;
+
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
};