[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Fri May 9 16:02:10 PDT 2025


================
@@ -1566,18 +1556,43 @@ void DAP::EventThread() {
             event_mask & lldb::SBTarget::eBroadcastBitModulesUnloaded ||
             event_mask & lldb::SBTarget::eBroadcastBitSymbolsLoaded ||
             event_mask & lldb::SBTarget::eBroadcastBitSymbolsChanged) {
-          llvm::StringRef reason = GetModuleEventReason(event_mask);
           const uint32_t num_modules =
               lldb::SBTarget::GetNumModulesFromEvent(event);
           for (uint32_t i = 0; i < num_modules; ++i) {
             lldb::SBModule module =
                 lldb::SBTarget::GetModuleAtIndexFromEvent(i, event);
             if (!module.IsValid())
               continue;
+            llvm::StringRef module_id = module.GetUUIDString();
+            if (module_id.empty())
+              continue;
+
+            llvm::StringRef reason;
+            bool id_only = false;
+            {
+              std::lock_guard<std::mutex> guard(modules_mutex);
----------------
ashgti wrote:

Should we grab this lock while we iterate the entire list of modules from the event?

I think we could we get a modules request in the middle of processing this list, which might be a bit inconsistent when we get back to handling the events.

https://github.com/llvm/llvm-project/pull/139324


More information about the lldb-commits mailing list