History

Added vm_id to vm_module_t that is used by the VM to uniquely identify a module Updated tool dispatcher to pass on the loaded_vm_module_t type as the module_vm_load event argument Debugger now uses symbol data to resolve stack IPs

arr committed 9 years ago

Commit 72f24ec1 parent a3c184b10 files · +160 −35Browse files

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

Unified · Split

src/vm/vm.cpp+7−4
@@ -134,6 +134,8 @@ std::shared_ptr<runtime::vm_module_t> vm_t::load_module(const char *path) · 133 unmodified lines
134134 if (module == nullptr)
135135 {
136136 module = std::shared_ptr<vm_module_t>{ std::move(read_module(path)) };
137+ module->vm_id = iter->vm_id;
138+
137139 iter->module = module;
138140
139141 debug::log_msg(debug::component_trace_t::module, debug::log_level_t::debug, "reload: vm module: >>%s<<\n", path);
@@ -157,11 +159,12 @@ std::shared_ptr<runtime::vm_module_t> vm_t::load_module(const char *path) · 17 unmodified lines
157159
158160 auto path_local = std::make_unique<vm_string_t>(std::strlen(path), reinterpret_cast<const uint8_t *>(path));
159161
160− auto load_id_next = std::size_t{ 0 };
162+ auto vm_id_next = std::size_t{ 1 };
161163 if (!_modules.empty())
162− load_id_next = (_modules.front().load_id + 1);
164+ vm_id_next = (_modules.front().vm_id + 1);
163165
164− _modules.push_front(std::move(loaded_vm_module_t{ load_id_next, std::move(path_local), new_module }));
166+ new_module->vm_id = vm_id_next;
167+ _modules.push_front(std::move(loaded_vm_module_t{ vm_id_next, std::move(path_local), new_module }));
165168 new_module_iter = _modules.begin();
166169 }
167170
@@ -169,7 +172,7 @@ std::shared_ptr<runtime::vm_module_t> vm_t::load_module(const char *path) · 1 unmodified line
169172 {
170173 std::lock_guard<std::mutex> lock{ _tool_dispatch_lock };
171174 if (_tool_dispatch != nullptr)
172− _tool_dispatch->on_module_vm_load(new_module, *new_module_iter->origin);
175+ _tool_dispatch->on_module_vm_load(*new_module_iter);
173176 }
174177
175178 if (debug::is_component_tracing_enabled<debug::component_trace_t::module>())