Skip to content

[SR-10527] swift-lldb crashes setting breakpoint on app with deployment target <12.0 #4571

Open
@swift-ci

Description

@swift-ci
Previous ID SR-10527
Radar None
Original Reporter ivhernandez (JIRA User)
Type Bug
Environment

Xcode 10.2.1
lldb version 7.0.0
Swift version 5.0-dev (LLVM 06f1615069, Swift d5426bc)

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

md5: 0195b20bfcafd1f5f212126750e70ab6

Issue Description:

Repro Steps:

  1. Create a new single view application Xcode project.

  2. Set deployment target to 11.4 or anything below 12.0.

  3. Build application.

  4. Boot, install, launch on a simulator with simctl.

  5. Attach to process by pid with swift-lldb.

  6. Run command: `b ViewController.swift:14`

The crash is occuring in GenType.cpp in swift::irgen::TypeConverter::TypeConverter() with error:
_LLVM ERROR: Cannot read '/Users/ivanhernandez/Desktop/GitHub_Clones/swift-lldb/build/Debug/LLDB.framework/Resources/Swift/iphonesimulator/layouts-x86_64.yaml'
Assertion failed: (e == 0), function ~recursive_mutex, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/libcxx/libcxx-400.9.4/src/mutex.cpp, line 64._

This occurs when using a deployment target under 12.0. Looks like the crash is avoided in iOS >= 12.0 because the TypeConverter constructor returns early if SupportsObjCMetadataUpdateCallback(Triple) is true which happens when iOS version is >=12.2 or macOS version >= 10.14.4. When using deployment target 12.0 or greater, the triple is set to "x86_64--macosx12.2.0" for some reason and 12.2.0 >= 10.14.4 so the constructor exits early. On iOS 11.4 and lower, the triple is "x86_64-apple-ios11.4.0". The constructor does not returns early and instead tries to read LLDB.framework/Resources/Swift/iphonesimulator/layouts-x86_64.yaml which doesn't exist and swift-lldb crashes.

I am using swift-lldb built from the 'stable' branch at commit d5426bc and swift from the 'master' branch. This crash does not occur when using swift-lldb and swift from the 'swift-5.0-branch' branch.

*Stack trace: *
(lldb) bt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions