summaryrefslogtreecommitdiff
path: root/src/arch/arm/insts
diff options
context:
space:
mode:
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;
};