Uploaded image for project: 'Swift'
  1. Swift
  2. SR-11732

LLDB crashes when debugging a Swift + Objc app with static libraries, using -no-serialize-debugging-options

    XMLWordPrintable

    Details

      Description

      I'm seeing a crash with the following synopsis:

      Assertion failed: (FoundCXX && "Record type mismatch"), function VisitRecordDecl, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/tools/clang/lib/AST/ASTImporter.cpp, line 2678.
       
      I've been able to reliably cause LLDB to crash when debugging an app that uses multiple static libraries, where at least 1 static library is Swift based and depends on a different Objective-C based static library. The important steps for repro are: disable serialize debugging options and rely on a struct from iOS SDK (e.g. CGRect, UIEdgeInsets) in the Objective-C code. I'm attaching a crash report from LLDB and an example Xcode project that demonstrates the crash.

      In my Xcode project, I've used a xcconfig to set -no-serialize-debug-options for the Swift components and customized the Swift import paths to find a modulemap file for the Objective-C based static library. This is configured to be as similar as possible to my "real" projects that use Bazel.

      The Xcode project includes:
      1. An app target with an empty Swift file, this is just to link together the relevant static libraries.
      2. A Swift based static library, AppLibrary, that includes the app's AppDelegate.
      3. An Objective-C based static library, CoreLibrary, which includes an Objective-C view controller. This implementation includes a method whose signature includes a CGRect, which seems to be part of the root cause of the LLDB crash.

      I repro'd this on the latest available toolchain snapshot, from 11/6/19.

      I believe this is specific to Swift's LLDB because there are no issues with similar pure Objective-C projects.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            dylansturg Dylan Sturgeon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: