From 6891cb37a238d1e00b2bd66392b27f278abd4614 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 25 Mar 2025 12:17:27 -0700 Subject: [PATCH] [LLDB] Turn off resilience bypass for textual swiftinterface files As the old comment indicates, it was not expected that build systems would register binary swift modules produced from textual interfaces with -add_ast_path, but we have found examples of the in the wild and it leads to the most unexpected side effects. Fixing this is straightforward, we can just check if a binary module was compiled from a textual interface and then not bypass resilience. rdar://145226754 --- lib/Serialization/SerializedModuleLoader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index acda28350da2f..c0d81d8d45b79 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -1788,10 +1788,11 @@ MemoryBufferSerializedModuleLoader::loadModule(SourceLoc importLoc, Ctx.removeLoadedModule(moduleID.Item); return nullptr; } - // The MemoryBuffer loader is used by LLDB during debugging. Modules imported - // from .swift_ast sections are never produced from textual interfaces. By - // disabling resilience the debugger can directly access private members. - if (BypassResilience) + // The MemoryBuffer loader is used by LLDB during debugging. Modules + // imported from .swift_ast sections are not typically produced from + // textual interfaces. By disabling resilience, the debugger can + // directly access private members. + if (BypassResilience && !M->isBuiltFromInterface()) M->setBypassResilience(); return M;