0

enter image description here According to https://developer.apple.com/videos/play/wwdc2022/110370/, it is mentioned that a dSYM bundle can contain swift modules, but I just cannot reproduce this when trying to build a framework of a dynamic lib. I have already set Debug Information Format to DWARF with dSYM file and build Libraries for Distribution to Yes, but the generated dSYM bundle only contains Contents/Resource/DWARF, but no .swiftmodule or .swiftinterface files.

Where did I get it wrong?

1
  • I do see mentions of my library's swiftmodule when I do dwarfdump -a <myApp.dSYM>. Is that what you're looking? Commented Mar 6, 2023 at 20:38

1 Answer 1

0

The swift module is incorporated into the dSYM's DWARF containing binaries as a separate section (__swift_ast) rather than being emitted as separate files into the dSYM bundle. You can use otool -v on the debug info file to verify that this section is present.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks! I initially thought that there could be separate swiftmodule files because I saw that in Apple's LLDB source code, SwiftASTContext::CreateInstance actually looks for path "Contents/Resources/Swift/<arch>". If the swiftmodule is embedded in DWARF, then what's the purpose of this code? Or, this means when we are using swiftinterface files, we put them into seperate folders, but when swiftmodule wins over swiftinterface, we emit it in __swit_ast section? Not sure if I understand this right.
The swiftmodule is a binary dump of compiler state; to use it the version of swift contained in lldb must match the version of the compiler that built the swiftmodule. The swift interfaces are textual and (except for source breaking compiler changes) any version of lldb can use them. But swift interface files only contain public interfaces, which renders them less useful for debugging the framework. So the best course is to include both artifacts in the dSYM, use the swiftmodule if you can, and fall back to the swift interface if there's a mismatch between compiler versions.
I'm trying to find a way if the symbols from a static library have made their way into app's dSYM. For assessing that I did otool -v myApp.dSYM, but I'm getting one of -fahlLtdoOrTMRIHCGScisPx or --version must be specified error. Can clarify what you meant and if possible mention a way to validate if the symbols from my .a have made into the app's dSYM?
or perhaps as long as my app works and my has a proper dSYM, then I'm to safely assume that the dSYM will be generated for the static library as well?
otool, nm and Co. don't do the job of finding the binary in the dSYM. You have to explicitly run them on <binary>.dSYM/Contents/Resources/DWARF/<binary>. For listing symbols you want to use nm - otool lists sections & load information, nm lists symbol information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.