changeset 981fc6fba01a in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=981fc6fba01a
description:
ARM: Show branch targets relative to the nearest symbol.
diffstat:
3 files changed, 25 insertions(+), 6 deletions(-)
src/arch/arm/insts/branch.cc | 9 +++------
src/arch/arm/insts/static_inst.cc | 18 ++++++++++++++++++
src/arch/arm/insts/static_inst.hh | 4 ++++
diffs (70 lines):
diff -r 43950710afdc -r 981fc6fba01a src/arch/arm/insts/branch.cc
--- a/src/arch/arm/insts/branch.cc Sat Jun 27 00:29:12 2009 -0700
+++ b/src/arch/arm/insts/branch.cc Sat Jun 27 00:29:30 2009 -0700
@@ -71,14 +71,11 @@
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 -r 43950710afdc -r 981fc6fba01a src/arch/arm/insts/static_inst.cc
--- a/src/arch/arm/insts/static_inst.cc Sat Jun 27 00:29:12 2009 -0700
+++ b/src/arch/arm/insts/static_inst.cc Sat Jun 27 00:29:30 2009 -0700
@@ -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 @@
}
}
+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 -r 43950710afdc -r 981fc6fba01a src/arch/arm/insts/static_inst.hh
--- a/src/arch/arm/insts/static_inst.hh Sat Jun 27 00:29:12 2009 -0700
+++ b/src/arch/arm/insts/static_inst.hh Sat Jun 27 00:29:30 2009 -0700
@@ -65,6 +65,10 @@
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;
};
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev