aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHesham Almatary <Hesham.Almatary@cl.cam.ac.uk>2018-10-17 12:42:57 +0100
committerHesham Almatary <Hesham.Almatary@cl.cam.ac.uk>2018-10-18 16:09:32 +0100
commitdc6871efeff5db90e476c963ac62e7fdc360654a (patch)
tree331b7704bd64bc80ee5e4684532ddf8102dfcf60
parentf54ff67b56592a28ce5b5ed729ceb6ad22f7cb8d (diff)
downloadriscv-isa-sim-dc6871efeff5db90e476c963ac62e7fdc360654a.zip
riscv-isa-sim-dc6871efeff5db90e476c963ac62e7fdc360654a.tar.gz
riscv-isa-sim-dc6871efeff5db90e476c963ac62e7fdc360654a.tar.bz2
Provide a noisy until interactive command
This is useful for example when the trace until a PC value needs to be extracted (#246)
-rw-r--r--riscv/interactive.cc22
-rw-r--r--riscv/sim.h4
2 files changed, 20 insertions, 6 deletions
diff --git a/riscv/interactive.cc b/riscv/interactive.cc
index b645c29..c96c71a 100644
--- a/riscv/interactive.cc
+++ b/riscv/interactive.cc
@@ -73,8 +73,9 @@ void sim_t::interactive()
funcs["pc"] = &sim_t::interactive_pc;
funcs["mem"] = &sim_t::interactive_mem;
funcs["str"] = &sim_t::interactive_str;
- funcs["until"] = &sim_t::interactive_until;
- funcs["while"] = &sim_t::interactive_until;
+ funcs["until"] = &sim_t::interactive_until_silent;
+ funcs["untiln"] = &sim_t::interactive_until_noisy;
+ funcs["while"] = &sim_t::interactive_until_silent;
funcs["quit"] = &sim_t::interactive_quit;
funcs["q"] = funcs["quit"];
funcs["help"] = &sim_t::interactive_help;
@@ -123,6 +124,7 @@ void sim_t::interactive_help(const std::string& cmd, const std::vector<std::stri
"str <hex addr> # Show NUL-terminated C string\n"
"until reg <core> <reg> <val> # Stop when <reg> in <core> hits <val>\n"
"until pc <core> <val> # Stop when PC in <core> hits <val>\n"
+ "untiln pc <core> <val> # Run noisy and stop when PC in <core> hits <val>\n"
"until mem <addr> <val> # Stop when memory <addr> becomes <val>\n"
"while reg <core> <reg> <val> # Run while <reg> in <core> is <val>\n"
"while pc <core> <val> # Run while PC in <core> is <val>\n"
@@ -314,9 +316,19 @@ void sim_t::interactive_str(const std::string& cmd, const std::vector<std::strin
putchar('\n');
}
-void sim_t::interactive_until(const std::string& cmd, const std::vector<std::string>& args)
+void sim_t::interactive_until_silent(const std::string& cmd, const std::vector<std::string>& args)
{
- bool cmd_until = cmd == "until";
+ interactive_until(cmd, args, false);
+}
+
+void sim_t::interactive_until_noisy(const std::string& cmd, const std::vector<std::string>& args)
+{
+ interactive_until(cmd, args, true);
+}
+
+void sim_t::interactive_until(const std::string& cmd, const std::vector<std::string>& args, bool noisy)
+{
+ bool cmd_until = cmd == "until" || cmd == "untiln";
if(args.size() < 3)
return;
@@ -351,7 +363,7 @@ void sim_t::interactive_until(const std::string& cmd, const std::vector<std::str
}
catch (trap_t t) {}
- set_procs_debug(false);
+ set_procs_debug(noisy);
step(1);
}
}
diff --git a/riscv/sim.h b/riscv/sim.h
index b847bdb..e42808b 100644
--- a/riscv/sim.h
+++ b/riscv/sim.h
@@ -90,7 +90,9 @@ private:
void interactive_pc(const std::string& cmd, const std::vector<std::string>& args);
void interactive_mem(const std::string& cmd, const std::vector<std::string>& args);
void interactive_str(const std::string& cmd, const std::vector<std::string>& args);
- void interactive_until(const std::string& cmd, const std::vector<std::string>& args);
+ void interactive_until(const std::string& cmd, const std::vector<std::string>& args, bool noisy);
+ void interactive_until_silent(const std::string& cmd, const std::vector<std::string>& args);
+ void interactive_until_noisy(const std::string& cmd, const std::vector<std::string>& args);
reg_t get_reg(const std::vector<std::string>& args);
freg_t get_freg(const std::vector<std::string>& args);
reg_t get_mem(const std::vector<std::string>& args);