History

Update registers struct to include next_pc member. This allows the pc member to always point at the current PC instead of having been incremented to the 'next' PC.

arr committed 9 years ago

Commit a46f30c1 parent 87f2d5b6 files · +67 −68Browse files

Showing the changes to src/vm/tool_dispatch.cpp (1 of 6 files). Show all

Unified · Split

src/vm/tool_dispatch.cpp+1−2
@@ -364,7 +364,6 @@ void vm_tool_dispatch_t::resume_all_threads() · 363 unmodified lines
364std::tuple<opcode_t, cookie_t> vm_tool_dispatch_t::get_original_opcode_and_cookie(const vm_registers_t &r)364std::tuple<opcode_t, cookie_t> vm_tool_dispatch_t::get_original_opcode_and_cookie(const vm_registers_t &r)
365{365{
366 const auto module = r.module_ref->module.get();366 const auto module = r.module_ref->module.get();
367 const auto current_pc = r.pc - 1;
368 367
369 if (module == nullptr || util::has_flag(module->header.runtime_flag, runtime_flags_t::builtin))368 if (module == nullptr || util::has_flag(module->header.runtime_flag, runtime_flags_t::builtin))
370 throw vm_system_exception{ "Unable to determine original opcode in supplied module" };369 throw vm_system_exception{ "Unable to determine original opcode in supplied module" };
@@ -375,7 +374,7 @@ std::tuple<opcode_t, cookie_t> vm_tool_dispatch_t::get_original_opcode_and_cooki · 4 unmodified lines
375 if (iter_orig != _breakpoints.original_opcodes.cend())374 if (iter_orig != _breakpoints.original_opcodes.cend())
376 {375 {
377 auto &pc_map = iter_orig->second;376 auto &pc_map = iter_orig->second;
378 auto iter_pc = pc_map.find(current_pc);377 auto iter_pc = pc_map.find(r.pc);
379 if (iter_pc != pc_map.cend())378 if (iter_pc != pc_map.cend())
380 return iter_pc->second;379 return iter_pc->second;
381 }380 }