From dc6871efeff5db90e476c963ac62e7fdc360654a Mon Sep 17 00:00:00 2001 From: Hesham Almatary Date: Wed, 17 Oct 2018 12:42:57 +0100 Subject: Provide a noisy until interactive command This is useful for example when the trace until a PC value needs to be extracted (#246) --- riscv/interactive.cc | 22 +++++++++++++++++----- riscv/sim.h | 4 +++- 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 # Show NUL-terminated C string\n" "until reg # Stop when in hits \n" "until pc # Stop when PC in hits \n" + "untiln pc # Run noisy and stop when PC in hits \n" "until mem # Stop when memory becomes \n" "while reg # Run while in is \n" "while pc # Run while PC in is \n" @@ -314,9 +316,19 @@ void sim_t::interactive_str(const std::string& cmd, const std::vector& args) +void sim_t::interactive_until_silent(const std::string& cmd, const std::vector& args) { - bool cmd_until = cmd == "until"; + interactive_until(cmd, args, false); +} + +void sim_t::interactive_until_noisy(const std::string& cmd, const std::vector& args) +{ + interactive_until(cmd, args, true); +} + +void sim_t::interactive_until(const std::string& cmd, const std::vector& 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& args); void interactive_mem(const std::string& cmd, const std::vector& args); void interactive_str(const std::string& cmd, const std::vector& args); - void interactive_until(const std::string& cmd, const std::vector& args); + void interactive_until(const std::string& cmd, const std::vector& args, bool noisy); + void interactive_until_silent(const std::string& cmd, const std::vector& args); + void interactive_until_noisy(const std::string& cmd, const std::vector& args); reg_t get_reg(const std::vector& args); freg_t get_freg(const std::vector& args); reg_t get_mem(const std::vector& args); -- cgit v1.1