mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When debugging Objective-C or C++ code on Darwin, the debug info collected by dsymutil in the .dSYM bundle is entirely self-contained. It is possible to debug a program, set breakpoints and print variables even without having the complete original source code or a matching SDK available. With Swift, this is currently not the case. Even though .dSYM bundles contain the binary .swiftmodule for all Swift modules, any Clang modules that the Swift modules depend on, still need to be imported from source to even get basic LLDB functionality to work. If ClangImporter fails to import a Clang module, effectively the entire Swift module depending on it gets poisoned. This patch is addressing this issue by introducing a ModuleLoader that can ask queries about Clang Decls to LLDB, since LLDB knows how to reconstruct Clang decls from DWARF and clang -gmodules producxes full debug info for Clang modules that is embedded into the .dSYM budle. This initial version does not contain any advanced functionality at all, it merely produces an empty ModuleDecl. Intertestingly, even this is a considerable improvement over the status quo. LLDB can now print Swift-only variables in modules with failing Clang depenecies, and becuase of fallback mechanisms that were implemented earlier, it can even display the contents of pure Objective-C objects that are imported into Swift. C structs obviously don't work yet. rdar://problem/36032653