Post marked as solved
Post marked as solved with 5 replies, 4,253 views
similiar to
Error when debugging: Cannot creat… | Apple Developer Forums - https://developer.apple.com/forums/thread/651375
Xcode 12 beta 1 po command in de… | Apple Developer Forums - https://developer.apple.com/forums/thread/651157
which do not resolve this issue that I am encountering
Description of problem
I am seeing an error which prevents using lldb debugger on Swift code/projects. It is seen on any Swift or SwiftUI project that I've tried. This is the error displayed in lldb console when first breakpoint is encountered:
Cannot create Swift scratch context (couldn't create a ClangImporter)(lldb)
Xcode Version 12.3 (12C33)
macOS Big Sur Intel M1
Troubleshooting
I originally thought this was also working on an Intel Mac running Big Sur/Xcode 12.3, but was mistaken. Using my customized shell environment on the following setups, I encounter the same couldn't create a ClangImporter.
M1 Mac mini, main account (an "Admin" account)
same M1 Mac mini, new "dev" account (an "Admin" account)
Intel MBP, main account
They are all using an Intel Homebrew install, and my customized shell environment if that provides a clue?
I captured some lldb debugging info by putting expr types in ~/.lldbinit but the outputs were basically identical (when discounting scratch file paaths and memory addresses) compared to the "working clean" account log (described below)
log enable -f /tmp/lldb-log.txt lldb expr types
works in a "clean" user account
I created a new, uncustomized "Standard" testuser account on the M1 Mac mini, and launched the same system Xcode.app. There was no longer this error message, and was able to inspect variables at a swift program breakpoint in Swift context, including po symbol.
Impact
Effectively this makes the debugger in Swift on Xcode projects on my systems essentially unable to inspect Swift contexts' state.