diff --git a/sim/atomsim.cpp b/sim/atomsim.cpp index 0e1030d0..aa6a1e5a 100755 --- a/sim/atomsim.cpp +++ b/sim/atomsim.cpp @@ -11,7 +11,7 @@ Atomsim::Atomsim(Atomsim_config sim_config, Backend_config bk_config): backend_(this, bk_config) // create backend { // get input file disassembly - disassembly_ = getDisassembly(sim_config_.ifile); + getDisassembly(&disassembly_, sim_config_.ifile); // clear breakpoints for(int i=0; i getDisassembly(std::string filename) +void getDisassembly(std::map *dis, std::string filename) { std::string command = ""; #ifdef RV32_COMPILER @@ -223,9 +223,6 @@ std::map getDisassembly(std::string filename) std::string output = GetStdoutFromCommand(command); std::stringstream s(output); - - // Parse command output - std::map dis; std::string line; bool in_disassembly = false; @@ -274,12 +271,15 @@ std::map getDisassembly(std::string filename) .instr = instrn, .disassembly = dism }; - dis.insert({addr, dl}); + + // insert if not already present + if(dis->count(addr) == 0) { + dis->insert({addr, dl}); + } } else { // Parse the rest // printf("Unk[%s]\n", line.c_str()); } } - return dis; } \ No newline at end of file diff --git a/sim/util.hpp b/sim/util.hpp index 1c567e27..ef75b692 100755 --- a/sim/util.hpp +++ b/sim/util.hpp @@ -176,7 +176,7 @@ struct DisassembledLine /** * @brief Get the Disassembly of input file using riscv objdump * + * @param dis std::map map of disassembly * @param filename input filename - * @return std::map map of disassembly */ -std::map getDisassembly(std::string filename); \ No newline at end of file +void getDisassembly(std::map *dis, std::string filename); \ No newline at end of file