@@ -342,8 +342,10 @@ void sim_t::interactive()
342
342
(this ->*funcs[cmd])(cmd, args);
343
343
else
344
344
out << " Unknown command " << cmd << std::endl;
345
- } catch (trap_t & t) {
345
+ } catch (trap_interactive & t) {
346
346
out << " Bad or missing arguments for command " << cmd << std::endl;
347
+ } catch (trap_t & t){
348
+ out << " Received trap: " << t.name () << std::endl;
347
349
}
348
350
#ifdef HAVE_BOOST_ASIO
349
351
if (socketif)
@@ -473,15 +475,9 @@ void sim_t::interactive_insn(const std::string& cmd, const std::vector<std::stri
473
475
int max_xlen = p->get_isa ().get_max_xlen ();
474
476
475
477
std::ostream out (sout_.rdbuf ());
476
- try
477
- {
478
- insn_t insn (get_insn (args));
479
- out << std::hex << std::setfill (' 0' ) << " 0x" << std::setw (max_xlen/4 )
480
- << zext (insn.bits (), max_xlen) << " " << p->get_disassembler ()->disassemble (insn) << std::endl;
481
- }
482
- catch (trap_t & t) {
483
- out << " Unable to obtain insn due to " << t.name () << std::endl;
484
- }
478
+ insn_t insn (get_insn (args)); // ensure this is outside of ostream to not pollute output on non-interactive trap
479
+ out << std::hex << std::setfill (' 0' ) << " 0x" << std::setw (max_xlen/4 )
480
+ << zext (insn.bits (), max_xlen) << " " << p->get_disassembler ()->disassemble (insn) << std::endl;
485
481
}
486
482
487
483
void sim_t::interactive_priv (const std::string& cmd, const std::vector<std::string>& args)
@@ -717,8 +713,9 @@ void sim_t::interactive_mem(const std::string& cmd, const std::vector<std::strin
717
713
int max_xlen = procs[0 ]->get_isa ().get_max_xlen ();
718
714
719
715
std::ostream out (sout_.rdbuf ());
716
+ reg_t mem_val = get_mem (args); // ensure this is outside of ostream to not pollute output on non-interactive trap
720
717
out << std::hex << " 0x" << std::setfill (' 0' ) << std::setw (max_xlen/4 )
721
- << zext (get_mem (args) , max_xlen) << std::endl;
718
+ << zext (mem_val , max_xlen) << std::endl;
722
719
}
723
720
724
721
void sim_t::interactive_str (const std::string& cmd, const std::vector<std::string>& args)
0 commit comments