Author: Jonas Devlieghere Date: 2025-05-20T18:51:59-07:00 New Revision: 7b513393872fe608721ce4014606b03dd780a5c9
URL: https://github.com/llvm/llvm-project/commit/7b513393872fe608721ce4014606b03dd780a5c9 DIFF: https://github.com/llvm/llvm-project/commit/7b513393872fe608721ce4014606b03dd780a5c9.diff LOG: [lldb-dap] Avoid double 'new' events for dyld on Darwin (#140810) I got a bug report where a pedantic DAP client complains about getting two "new" module events for the same UUID. This is caused by the dyld transition from the on-disk dyld to the shared cache dyld, which share the same UUID. The transition is not generating an unloaded event (because we're not really unloading dyld) but we do get a loaded event (because the load address changed). This PR fixes the issue by relying on the modules set as the source of truth instead of relying on the event type. Added: Modified: lldb/tools/lldb-dap/DAP.cpp Removed: ################################################################################ diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp index 3419b2c3a841b..f6241b7d98456 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -1292,15 +1292,7 @@ void DAP::EventThread() { llvm::StringRef reason; bool id_only = false; - if (event_mask & lldb::SBTarget::eBroadcastBitModulesLoaded) { - modules.insert(module_id); - reason = "new"; - } else { - // If this is a module we've never told the client about, don't - // send an event. - if (!modules.contains(module_id)) - continue; - + if (modules.contains(module_id)) { if (event_mask & lldb::SBTarget::eBroadcastBitModulesUnloaded) { modules.erase(module_id); reason = "removed"; @@ -1308,6 +1300,9 @@ void DAP::EventThread() { } else { reason = "changed"; } + } else { + modules.insert(module_id); + reason = "new"; } llvm::json::Object body; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits