aboutsummaryrefslogtreecommitdiff
path: root/riscv/interactive.cc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-05 21:13:04 +0800
committerMike Frysinger <vapier@gentoo.org>2015-06-05 21:13:04 +0800
commit74225c6f45ae5e79c03a73012fdfb64791d24748 (patch)
tree342159beabdb9bbf32b027985ef2f0c172a75fd7 /riscv/interactive.cc
parent89be91cec3677f3f1143972de7ca85e2dc33dbff (diff)
downloadspike-74225c6f45ae5e79c03a73012fdfb64791d24748.zip
spike-74225c6f45ae5e79c03a73012fdfb64791d24748.tar.gz
spike-74225c6f45ae5e79c03a73012fdfb64791d24748.tar.bz2
add an interactive "pc" command
This lets you show the current pc quickly. Sometimes when displaying different state you can lose track of what the pc was. Add a simple command that plumbs in the existing functions to the user interface.
Diffstat (limited to 'riscv/interactive.cc')
-rw-r--r--riscv/interactive.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/riscv/interactive.cc b/riscv/interactive.cc
index c4eb869..689b53a 100644
--- a/riscv/interactive.cc
+++ b/riscv/interactive.cc
@@ -66,6 +66,7 @@ void sim_t::interactive()
funcs["reg"] = &sim_t::interactive_reg;
funcs["fregs"] = &sim_t::interactive_fregs;
funcs["fregd"] = &sim_t::interactive_fregd;
+ funcs["pc"] = &sim_t::interactive_pc;
funcs["mem"] = &sim_t::interactive_mem;
funcs["str"] = &sim_t::interactive_str;
funcs["until"] = &sim_t::interactive_until;
@@ -111,6 +112,7 @@ void sim_t::interactive_help(const std::string& cmd, const std::vector<std::stri
"reg <core> <reg> # Display <reg> in <core>\n"
"fregs <core> <reg> # Display single precision <reg> in <core>\n"
"fregd <core> <reg> # Display double precision <reg> in <core>\n"
+ "pc <core> # Show current PC in <core>\n"
"mem <hex addr> # Show contents of physical memory\n"
"str <hex addr> # Show NUL-terminated C string\n"
"until reg <core> <reg> <val> # Stop when <reg> in <core> hits <val>\n"
@@ -163,6 +165,11 @@ reg_t sim_t::get_pc(const std::vector<std::string>& args)
return p->state.pc;
}
+void sim_t::interactive_pc(const std::string& cmd, const std::vector<std::string>& args)
+{
+ fprintf(stderr, "0x%016" PRIx64 "\n", get_pc(args));
+}
+
reg_t sim_t::get_reg(const std::vector<std::string>& args)
{
if(args.size() != 2)