lldb fails to po variables in Swift

Originator:keithbsmiley
Number:rdar://34601923 Date Originated:22-Sep-2017 13:45
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.0 9A235
Classification:Other Bug Reproducible:Always
 
Summary:
Sometimes when attempting to po variables with lldb in Swift, it fails with this error:

```
error: in auto-import:
failed to get module '<redacted>' from AST context:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "UIKitOverlayShims.h"
        ^

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims/UIKitOverlayShims.h:24:11: error: use of undeclared identifier 'UIFocusSystem'
  return [UIFocusSystem environment:environment containsEnvironment:otherEnvironment];
          ^

error: could not build Objective-C module '_SwiftUIKitOverlayShims'
```

Steps to Reproduce:
1. Set a breakpoint in a Swift project
2. At the breakpoint run `po self`

Expected Results:
lldb prints the description of self

Actual Results:
It fails with this error

Version:
Xcode 9.0 9A235

Notes:
Here's a discussion on the developer forums about this issue: https://forums.developer.apple.com/thread/84400

The workaround of editing /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/shims to remove the UIFocusSystem call seems to work, although one time lldb also crashed when doing this, attached is the report hoping that might be useful for this or another issue.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!