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-3200] Cannot debug SwiftPM package in Xcode #5174

Closed
swift-ci opened this issue Nov 13, 2016 · 4 comments
Closed

[SR-3200] Cannot debug SwiftPM package in Xcode #5174

swift-ci opened this issue Nov 13, 2016 · 4 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-3200
Radar None
Original Reporter rlovelett (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s Compiler, LLDB for Swift, Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 6620695d87d14b9eaaa0a570821ed129

duplicates:

  • SR-3121 Auto-completion and Syntax coloring don't work most of the time with SwiftPM generated Xcode projects

Issue Description:

I've been trying to debug a program that is packaged/built with SwiftPM. Unfortunately, the Xcode project generated via swift package generate-xcodeproj cannot inspect the variables. Whenever I try to print an object from the lldb command-line in Xcode I get this error:

po r
warning: Swift error in module example.
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module SourceKittenFramework.
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module 'example' from AST context:

I've narrowed it down to a specific dependency, SourceKittenFramework, but I'm not sure if it is a bug in SwiftPM or in the package configuration or something else completely.

I've attached a minimal SwiftPM package ($ tar xvf cannot-debug.tar.xz) that should generate an Xcode project that exemplifies the issue.

@ankitspd
Copy link
Member

This looks like an issue with swift importing C modules. Debugger has that error when umbrella dir is used in modulemap i.e. In the attached package, changing

module See {
    umbrella "." // <---
    link "See"
    export *
}

to

module See {
    header "header.h"
    link "See"
    export *
}

resolves the issue.

How to reproduce?
$ unzip foo.zip && cd foo
$ xcrun --find swift
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-11-12-a.xctoolchain/usr/bin/swift
$ swift package generate-xcodeproj
$ open foo.xcodeproj
set break point at line 4 in main.swift
run bird scheme
(lldb) po foo()
warning: Swift error in module bird.
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module 'bird' from AST context:

Changing the modulemap to use header instead of umbrella dir (and clean build) fixes the issue.

foo.zip

@ddunbar
Copy link
Member

ddunbar commented Nov 14, 2016

/cc jingham@apple.com (JIRA User)

@swift-ci
Copy link
Contributor Author

Comment by Ryan Lovelett (JIRA)

I've experienced this with yet another configuration. Using Yams at tag 0.1.4 or commit b64e0a230dc3c4f82cac1c8c46ae3def602131f6.

If you attempt to debug a simple program, e.g.,

import Yams

let node = try Node(string: "- 1: test")
print(node)

LLDB errors with:

(lldb) po node
warning: Swift error in module sample.
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module Yams.
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module 'sample' from AST context:

(lldb)

@ankitspd
Copy link
Member

I can't reproduce it anymore. The generated framework targets in the Xcode project were kind of broken which was fixed by SR-3121 so it was probably related to that.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants