diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-06-05 21:17:19 +0800 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-06-05 21:17:19 +0800 |
commit | 3e8ad1eab377710dd1f2df192bdec20536b11840 (patch) | |
tree | bdd1d7a2b1efe708a22e7549ef06466005a937ee /riscv/interactive.cc | |
parent | 74225c6f45ae5e79c03a73012fdfb64791d24748 (diff) | |
download | spike-3e8ad1eab377710dd1f2df192bdec20536b11840.zip spike-3e8ad1eab377710dd1f2df192bdec20536b11840.tar.gz spike-3e8ad1eab377710dd1f2df192bdec20536b11840.tar.bz2 |
allow interactive "reg" command to dump all registers
It you want to scan all the registers at once (or at least a few), having
to dump them one by one is kind of a pain. Change the behavior so that if
the register number is omitted, it'll dump all of them.
Diffstat (limited to 'riscv/interactive.cc')
-rw-r--r-- | riscv/interactive.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/riscv/interactive.cc b/riscv/interactive.cc index 689b53a..6ae1892 100644 --- a/riscv/interactive.cc +++ b/riscv/interactive.cc @@ -109,7 +109,7 @@ void sim_t::interactive_help(const std::string& cmd, const std::vector<std::stri { std::cerr << "Interactive commands:\n" - "reg <core> <reg> # Display <reg> in <core>\n" + "reg <core> [reg] # Display [reg] (all if omitted) 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" @@ -213,7 +213,17 @@ reg_t sim_t::get_freg(const std::vector<std::string>& args) void sim_t::interactive_reg(const std::string& cmd, const std::vector<std::string>& args) { - fprintf(stderr, "0x%016" PRIx64 "\n", get_reg(args)); + if (args.size() == 1) { + // Show all the regs! + processor_t *p = get_core(args[0]); + + for (int r = 0; r < NFPR; ++r) { + fprintf(stderr, "%-4s: 0x%016" PRIx64 " ", xpr_name[r], p->state.XPR[r]); + if ((r + 1) % 4 == 0) + fprintf(stderr, "\n"); + } + } else + fprintf(stderr, "0x%016" PRIx64 "\n", get_reg(args)); } union fpr |