Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11732] LLDB crashes when debugging a Swift + Objc app with static libraries, using -no-serialize-debugging-options #4557

Closed
swift-ci opened this issue Nov 7, 2019 · 3 comments
Labels
bug Something isn't working Crash LLDB for Swift

Comments

@swift-ci
Copy link

swift-ci commented Nov 7, 2019

Previous ID SR-11732
Radar rdar://problem/57087698
Original Reporter dylansturg (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Swift toolchain - Development Snapshot from 11/6/19

https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2019-11-06-a/swift-DEVELOPMENT-SNAPSHOT-2019-11-06-a-osx.pkg

Xcode version - 11.1 and 11.2.1 GM seed

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug, Crash
Assignee None
Priority Medium

md5: f5e19670c752d1a0f75ab31541b16ed0

Issue 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.

@swift-ci
Copy link
Author

swift-ci commented Nov 8, 2019

Comment by Dylan Sturgeon (JIRA)

I should note that this crash no longer occurs if I set `target.swift-extra-clang-flags` in the .lldinit file, which is probably the correct solution. But I think it would be better if LLDB didn't crash even when the correct clang flags are unavailable. Interestingly, I also discovered that the crash is prevented if I pass any clang flags that start with "--" (even if the flags are just bogus/garbage).

@beccadax
Copy link

@swift-ci create

@adrian-prantl
Copy link
Member

teemperor (JIRA User) fixed this upstream. This crash should no longer be possible in the current development branch.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Crash LLDB for Swift
Projects
None yet
Development

No branches or pull requests

3 participants