Skip to content

Commit 7b51339

Browse files
authored
[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.
1 parent 3cf6565 commit 7b51339

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,22 +1292,17 @@ void DAP::EventThread() {
12921292

12931293
llvm::StringRef reason;
12941294
bool id_only = false;
1295-
if (event_mask & lldb::SBTarget::eBroadcastBitModulesLoaded) {
1296-
modules.insert(module_id);
1297-
reason = "new";
1298-
} else {
1299-
// If this is a module we've never told the client about, don't
1300-
// send an event.
1301-
if (!modules.contains(module_id))
1302-
continue;
1303-
1295+
if (modules.contains(module_id)) {
13041296
if (event_mask & lldb::SBTarget::eBroadcastBitModulesUnloaded) {
13051297
modules.erase(module_id);
13061298
reason = "removed";
13071299
id_only = true;
13081300
} else {
13091301
reason = "changed";
13101302
}
1303+
} else {
1304+
modules.insert(module_id);
1305+
reason = "new";
13111306
}
13121307

13131308
llvm::json::Object body;

0 commit comments

Comments
 (0)