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
134 if (module == nullptr)134 if (module == nullptr)
135 {135 {
136 module = std::shared_ptr<vm_module_t>{ std::move(read_module(path)) };136 module = std::shared_ptr<vm_module_t>{ std::move(read_module(path)) };
137 module->vm_id = iter->vm_id;
138
137 iter->module = module;139 iter->module = module;
138 140
139 debug::log_msg(debug::component_trace_t::module, debug::log_level_t::debug, "reload: vm module: >>%s<<\n", path);141 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
157 159
158 auto path_local = std::make_unique<vm_string_t>(std::strlen(path), reinterpret_cast<const uint8_t *>(path));160 auto path_local = std::make_unique<vm_string_t>(std::strlen(path), reinterpret_cast<const uint8_t *>(path));
159 161
160 auto load_id_next = std::size_t{ 0 };162 auto vm_id_next = std::size_t{ 1 };
161 if (!_modules.empty())163 if (!_modules.empty())
162 load_id_next = (_modules.front().load_id + 1);164 vm_id_next = (_modules.front().vm_id + 1);
163 165
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 }));
165 new_module_iter = _modules.begin();168 new_module_iter = _modules.begin();
166 }169 }
167 170
@@ -169,7 +172,7 @@ std::shared_ptr<runtime::vm_module_t> vm_t::load_module(const char *path) · 1 unmodified line
169 {172 {
170 std::lock_guard<std::mutex> lock{ _tool_dispatch_lock };173 std::lock_guard<std::mutex> lock{ _tool_dispatch_lock };
171 if (_tool_dispatch != nullptr)174 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);
173 }176 }
174 177
175 if (debug::is_component_tracing_enabled<debug::component_trace_t::module>())178 if (debug::is_component_tracing_enabled<debug::component_trace_t::module>())